A minimal Rust client for PushService.StreamPush, using tonic and tokio.
rust/
Cargo.toml
build.rs # invokes tonic-build on ../../push.proto
src/main.rs
build.rs runs the proto compiler at build time, so there's no separate codegen step — cargo run does it for you.
- A recent Rust toolchain (1.75+).
protocavailable onPATH(tonic-buildshells out to it). On macOS:brew install protobuf.
export PUSH_API_KEY=...
export PUSH_API_SECRET=...
export PUSH_APP_ID=...
cargo runtonic-build follows the proto package declaration. Since push.proto declares package push;, the generated code is reachable as push::* via:
pub mod push {
tonic::include_proto!("push");
}Optional scalar fields (proto3 optional) become Option<T>. Optional message fields are always Option<T>. The two oneofs — PushStreamMessage.payload and PushStreamResponse.response — become Rust enums in submodules: push::push_stream_message::Payload and push::push_stream_response::Response.