DEV Community

Discussion on: A beginners guide to gRPC with Rust

Collapse
 
wotzhs profile image
Sean Wong

Hi Anshul, I am very new to Rust development, i find this article extremely helpful, however I am not quite clear with the statement below:

This will help us testing and maintaining code in save repo but it is not suggested for a large project

is this referring to the bin block in the cargo.toml? is so, may I know what would be the proper way to run the rust grpc server?

Collapse
 
anshulgoyal15 profile image
Anshul Goyal

Yes, the better way is to use cargo wrokspaces.

Collapse
 
wotzhs profile image
Sean Wong

Thanks Anshul, I have been looking at different gRPC crates and I think another way that to not use the cargo run --bin server is to use the statically generated code from protoc --rust_out and use them to build the grpc server manually.

Particularly I found github.com/tikv/grpc-rs.

I understood completely that this article was meant to demonstrate the dynamically genarated grpc server & client, so I hope this comment is not to be taken in the wrong light.

Thread Thread
 
anshulgoyal15 profile image
Anshul Goyal

Hi, Sean I always like to generate stubs at build time. It allows us to maintain a sync between protocol buffer definations and stubs. I think it is best practice to not to generate stubs before hand.

Thread Thread
 
wotzhs profile image
Sean Wong

yup, agreed, generating stub at build time guarantees the latest protobuf code, that's my preference too.