#tonic #rpc #protobuf

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

#1417 in Procedural macros

Download history 25/week @ 2024-06-08 10/week @ 2024-06-15 5/week @ 2024-06-22 47/week @ 2024-06-29 139/week @ 2024-07-06 182/week @ 2024-07-13 474/week @ 2024-07-20 167/week @ 2024-07-27 127/week @ 2024-08-03 186/week @ 2024-08-10 138/week @ 2024-08-17 96/week @ 2024-08-24 51/week @ 2024-08-31 10/week @ 2024-09-07 12/week @ 2024-09-14 41/week @ 2024-09-21

130 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

~325–790KB
~19K SLoC