#protobuf #grpc #blocking

pajamax-build

Codegen module of tonic gRPC implementation

2 unstable releases

new 0.2.0 May 23, 2025
0.1.0 May 16, 2025

#17 in #blocking

Download history 143/week @ 2025-05-14

143 downloads per month

MIT license

8KB
92 lines

pajamax-build

pajamax-build compiles .proto files via prost and generates service stubs and proto definitions for use with pajamax.

Usage

The usage is very similar to that of Tonic.

  1. Import pajamax and pajamax-build in your Cargo.toml:

    [dependencies]
    pajamax = "0.1"
    prost = "0.1"
    
    [build-dependencies]
    pajamax-build = "0.1"
    
  2. Call pajamax-build in build.rs:

    fn main() -> Result<(), Box<dyn std::error::Error>> {
        pajamax_build::compile_protos(&["proto/helloworld.proto"], &["."])?;
        Ok(())
    }
    

    If your want more options, call prost_build directly with PajamaxGen:

    fn main() -> Result<(), Box<dyn std::error::Error>> {
       prost_build::Config::new()
           // add your options here
           .service_generator(Box::new(pajamax_build::PajamaxGen()))
           .compile_protos(&["proto/helloworld.proto"], &["."])
    }
    
  3. Call pajamax in your source code. See the helloworld for more details.

Dependencies

~8–18MB
~251K SLoC