async-prost does not support asyncing the stream of prost 0.10.
I follow the tutorial of https://time.geekbang.org/column/article/425005 and repo:https://github.com/tyrchen/geektime-rust/blob/master/21_kv/Cargo.toml. If I change the version of prost from 0.9 to 0.10 and try to run the dummy_server by RUST_LOG=info cargo run --example dummy_server. I will get the error like the below while changing back to 0.9 is OK
error[E0599]: the method
sendexists for structAsyncProstStream<tokio::net::TcpStream, CommandRequest, CommandResponse, AsyncDestination>, but its trait bounds were not satisfied --> examples/dummy_server.rs:27:24 | 27 | stream.send(resp).await.unwrap(); | ^^^^ method cannot be called onAsyncProstStream<tokio::net::TcpStream, CommandRequest, CommandResponse, AsyncDestination>due to unsatisfied trait bounds | ::: /Users/boya/.cargo/registry/src/github.com-1ecc6299db9ec823/async-prost-0.3.0/src/stream.rs:24:1 | 24 | pub struct AsyncProstStream<S, R, W, D> { | --------------------------------------- | | | doesn't satisfy_: SinkExt<_>| doesn't satisfy_: futures::Sink<_>| = note: the following trait bounds were not satisfied:AsyncProstStream<tokio::net::TcpStream, CommandRequest, CommandResponse, AsyncDestination>: futures::Sink<_>which is required byAsyncProstStream<tokio::net::TcpStream, CommandRequest, CommandResponse, AsyncDestination>: SinkExt<_>
Didn't get a chance to try it. But I've upgrade to async-prost to use prost v0.10. That might fix the issue.
It does not support prost 0.11 now.
any fix for prost 0.11, errors are:
24 | pub struct AsyncProstStream<S, R, W, D> {
| ---------------------------------------
| |
| doesn't satisfy `_: Sink<_>`
| doesn't satisfy `_: SinkExt<_>`
|
= note: the following trait bounds were not satisfied:
`AsyncProstStream<tokio::net::TcpStream, CommandResponse, CommandRequest, AsyncDestination>: futures::Sink<_>`
which is required by `AsyncProstStream<tokio::net::TcpStream, CommandResponse, CommandRequest, AsyncDestination>: SinkExt<_>`
Here is how I solve the issue: I forked the async-prost crate and bump the dependency prost version to 0.12.1. If you hit the similar issue, you can use my fork in Cargo.toml file: async-prost = {git = "https://github.com/zhaopinglu/async-prost.git"}
You can also fork one if necessary.