Thalweg · API reference ← Main docs

Crate twg_proto_bundle

Crate twg_proto_bundle 

Source
Expand description

Bundle a protobuf source into the artefacts the descriptor toolkit and an operator need: one combined FileDescriptorSet (.pb), one proto3 file per package, and a fully-qualified message-type manifest. See ADR-0063 and docs/blueprints/proto-bundle-implementation-plan.md.

The source may be a single .proto, a bare directory of protos, or a Java/Maven/Gradle repo with many src/main/proto roots — all resolved through one entry point. Compilation is pure Rust via protox (no protoc on PATH).

use std::path::Path;
use twg_proto_bundle::{bundle, BundleOptions};

let out = bundle(Path::new("/path/to/proto-source"), Path::new("./out"), &BundleOptions::default())?;
// out.messages.roots contains e.g. "com.example.orders.Order"
std::fs::write("./out/bundle.pb", &out.descriptor_set).unwrap();

Structs§

Bundle
The in-memory result of bundling, returned regardless of what was written.
BundleOptions
Options controlling source resolution, conflict handling, and rendering.
EmitSet
Which artefacts to write to the output directory. All default on.
MessageManifest
The message-type inventory written to <name>.messages.json.
MissingImport
One unresolved import and the staged files that require it.
RenderedProto
One rendered proto3 file.

Enums§

BundleError
Anything that can go wrong resolving, deduping, compiling, or rendering a proto source into a bundle.
OnConflict
How to treat an import path that resolves to differing content under different include roots.
WktImports
Where the Google well-known-type imports live.

Functions§

bundle
Resolve, compile, and render source, writing the opts.emit subset to out_dir and returning the full Bundle.