grpc-rs icon indicating copy to clipboard operation
grpc-rs copied to clipboard

Q: is it possible to use grpc-rs with plain C based Protocol Buffers?

Open mw66 opened this issue 3 years ago • 1 comments

Hi,

Maybe this is a silly question: but is it possible to use grpc-rs with plain C based Protocol Buffers ? e.g.

https://github.com/nanopb/nanopb (for memory restricted system).

https://github.com/protobuf-c/protobuf-c

I think the output of those library are just C's struct, is it possible to use grpc-rs with these struct to achieve network communication?

Thanks!

mw66 avatar Oct 18 '22 18:10 mw66

Yes, but since grpc-rs is written in Rust, you may need to build up some bindings between C library and Rust.

grpc-rs runtime is developed without depending on specific codec, you can provide your known codec, check how it works in https://github.com/tikv/grpc-rs/blob/master/src/codec.rs. But gRPC is hard to used without a compiler, and compiler has to depend on specific codec. So to use a different protobuf library, you need to 1. provide codec function, 2. write a grpc compiler.

BusyJay avatar Oct 19 '22 04:10 BusyJay