Crate pajamax_build

Crate pajamax_build 

Source
Expand description

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.3"
    prost = "0.1"
    
    [build-dependencies]
    pajamax-build = "0.3"
  2. Call pajamax-build in build.rs:

    fn main() -> Result<(), Box<dyn std::error::Error>> {
        pajamax_build::compile_protos_in_local(&["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::Local))
           .compile_protos(&["proto/helloworld.proto"], &["."])
    }
  3. Call pajamax in your source code. See the local-mode example helloworld and dispatch-mode example dict-store for details.

Enums§

PajamaxGen
Specify the services to be compiled in local-mode or dispatch-mode.

Functions§

compile_protos_in_dispatch
Complie protofile. Build all services as dispatch-mode.
compile_protos_in_local
Complie protofile. Build all services as local-mode.
compile_protos_list_both
Complie protofile. Build some services as local-mode and some as dispatch-mode.
compile_protos_list_dispatch
Complie protofile. Build some services as dispatch-mode and others as local-mode.
compile_protos_list_local
Complie protofile. Build some services as local-mode and others as dispatch-mode.