#rpc #protobuf #tonic

macro proto

proto allows you to define Protocol Buffers using Rust code to reuse Rust’s type system and ecosystem

3 releases

0.1.2 May 26, 2024
0.1.1 May 26, 2024
0.1.0 May 26, 2024

#371 in #rpc

Download history 4/week @ 2024-11-13 12/week @ 2024-11-20 8/week @ 2024-11-27 20/week @ 2024-12-04 34/week @ 2024-12-11 24/week @ 2024-12-18 8/week @ 2024-12-25 6/week @ 2025-01-08 11/week @ 2025-01-15 7/week @ 2025-01-22 43/week @ 2025-01-29 21/week @ 2025-02-05 16/week @ 2025-02-12 21/week @ 2025-02-19 28/week @ 2025-02-26

90 downloads per month
Used in 2 crates (via astro-run-protocol)

MIT license

14KB
348 lines

proto

proto allows you to define Protocol Buffers using Rust code to reuse Rust's type system and ecosystem.

Example

use proto::proto;

fn main() {
  // Define a Protocol Buffers service
  let service = proto! {
    package example;
    codec crate::common::JsonCodec;

    service Greeter {
      rpc SayHello (crate::HelloRequest) returns (stream crate::HelloResponse) {}
    }
  };

  tonic_build::manual::Builder::new()
    .out_dir("./pb")
    .compile(&[service]);
}

Dependencies

~200–630KB
~15K SLoC