I've got the following method:
pub fn load_names(&self, req: &super::MagicQueryType) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver<String>> {
My goal is to get the very first element of grpcio::ClientSStreamReceiver
; I don't care about the other names:
let name: String = load_names(query)?.wait().nth(0)?;
It seems inefficient to call wait()
before nth(0)
as I believe wait()
blocks the stream until it receives all the elements.
How can I write a more efficient solution (i.e., nth(0).wait()
) without triggering build errors? Rust's build errors for futures::stream::Stream
look extremely confusing to me.
The Rust playground doesn't support grpcio = "0.4.4"
so I cannot provide a link.