Crate ttrpc_codegen

source ·
Expand description

API to generate .rs files for ttrpc from protobuf

use ttrpc_codegen::{Customize, Codegen, ProtobufCustomize};

fn main() {
    let protobuf_customized = ProtobufCustomize::default().gen_mod_rs(false);

    Codegen::new()
        .out_dir("protocols/asynchronous")
        .inputs(&protos)
        .include("protocols/protos")
        .rust_protobuf()
        .customize(Customize {
            async_all: true,
            ..Default::default()
        })
        .rust_protobuf_customize(protobuf_customized.clone())
        .run()
        .expect("Gen async code failed.");
 }

Structs

  • Invoke pure rust codegen.
  • Customize generated code.
  • Specifies style of generated code. Generated files can be customized using this proto or using rustproto.proto options.

Traits