Crate tonic_buf_build

Source
Expand description

tonic-buf-build allows you to integrate buf.build with tonic-build. Using buf.build and tonic, you can easily manage third party dependencies for proto files and generate code for your proto files in Rust. Works with both buf.yaml and buf.work.yaml.

§Usage

Add the following to your Cargo.toml:

tonic-buf-build = "*"
tonic-build = "*"

Then, in your build.rs:

fn main() -> Result<(), tonic_buf_build::error::TonicBufBuildError> {
   tonic_buf_build::compile_from_buf(tonic_build::configure(), None)?;
   Ok(())
}

To use buf workspaces, you simply call tonic-buf-build::compile_from_buf_workspace instead.

For complete and working examples, take a look at the examples folder.

Modules§

error

Structs§

TonicBufConfig

Functions§

compile_from_buf
compile_from_buf_with_config
compile_from_buf_workspace
compile_from_buf_workspace_with_config