Grpc library that uses async_std instead of tokio?

In my limited search on crates.io, every grpc library I have come across uses tokio. Is there any that uses async_std instead ? [Mainly an incremental buildtime issue for me.]

I'm pretty sure the answer is no.

Thanks for letting me know. The following question may be impossible to answer because the truth is "it's different form every crate."

Could you offer any insights why the existing grpc libraries aren't built against the async API, and instead are built against tokio ? I.e. what tokio specific features do they tend to utilize ? If I were to attempt to port one of these from tokio to async_std, what types of work should I be ready for ?

Pretty sure they use the network. Tokio and async_std each require a different and incompatible api for network connections.

Am I misunderstanding this here -- by network, are you referring to TCP / UDP connections ? I was just playing with async_std::net::TcpStream - Rust (async_tungstenite in particular, for websocket connections).

I don't see how it's possible to build "different and incompatible api" for TCP / UDP connections.

What I am misunderstanding here ?

It's simply whether they use the TcpStream type from async-std, or the one from Tokio.

Are the TcpStream types from async_std and tokio all that different? Is the core issue there is not a trait TcpStreamT that both async_std and tokio implements? (Therefore grpc crate writers have to write to an concrete struct rather than a Trait) ?

They are relatively similar, but there is no standard trait for them. Writing traits to abstract over the runtime is generally a surprisingly difficult problem. There are several attempts at such traits out there, but if the grpc library doesn't use them, then that doesn't help.

One thing you may be able to do is that hyper has some traits internally for replacing the runtime, if the gRPC has no runtime dependencies besides using hyper, then that is potentially a way to use another runtime.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.