async-prost icon indicating copy to clipboard operation
async-prost copied to clipboard

async-prost does not support asyncing the stream of prost 0.10.

Open wilbyang opened this issue 3 years ago • 4 comments

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 send exists for struct AsyncProstStream<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 on AsyncProstStream<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 by AsyncProstStream<tokio::net::TcpStream, CommandRequest, CommandResponse, AsyncDestination>: SinkExt<_>

wilbyang avatar May 27 '22 13:05 wilbyang

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.

tyrchen avatar May 30 '22 05:05 tyrchen

It does not support prost 0.11 now.

xuexin avatar Sep 19 '22 07:09 xuexin

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<_>`

li3p avatar Apr 18 '23 15:04 li3p

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.

zhaopinglu avatar Sep 20 '23 13:09 zhaopinglu