bomboni_prost for code generation and bomboni_proto for enhanced runtime types.
Architecture
Bomboni’s protobuf support is split into two main components:bomboni_prost
Build-time code generation with enhanced helpers and utilities
bomboni_proto
Runtime implementations of Google’s well-known types with additional functionality
When to Use Each Crate
bomboni_prost
Usebomboni_prost in your build.rs file when you need to:
- Compile
.protofiles into Rust code - Generate additional helper functions for messages and enums
- Add field name constants and utilities
- Enable serde serialization for protobuf types
- Map protobuf types to custom Rust implementations
build.rs
bomboni_proto
Usebomboni_proto in your runtime code when you need:
- Enhanced implementations of Google’s well-known types
Anytype conversions with automatic type URL handling- RPC status and error handling with detailed error types
- Field mask operations and utilities
- Serde serialization for protobuf well-known types
Integration with Tonic
Bomboni seamlessly integrates with tonic, the popular Rust gRPC framework.Build-time Integration
Usebomboni_prost alongside tonic’s build tools:
build.rs
Runtime Integration
With thetonic feature enabled, bomboni_proto provides automatic conversions between Bomboni’s Status type and tonic’s Status:
Key Features
Enhanced Code Generation
Enhanced Code Generation
bomboni_prost generates additional helper functions beyond standard prost output:- Field name constants for reflection
- Enum value name arrays
- Oneof variant utilities
- Automatic From/Into conversions
Serde Integration
Serde Integration
Comprehensive serialization support for all generated types:
- Automatic Serialize/Deserialize implementations
- Custom serde helpers for enum fields
- Proper handling of protobuf conventions in JSON
Well-Known Types
Well-Known Types
bomboni_proto provides enhanced implementations:Anytype with easy conversionsStatuswith rich error detailsFieldMaskwith path operationsTimestamp,Duration, and wrapper types
Type Safety
Type Safety
Strong type safety throughout:
- Compile-time guarantees for type URLs
- Safe enum conversions
- Type-checked field masks
Cargo Features
bomboni_proto Features
tonic- Enable tonic integration with Status conversionschrono- Enable compatibility with chrono datetime librarywasm- Enable WebAssembly supportjs- Enable JavaScript-specific type mappingstesting- Enable testing utilities
Cargo.toml
Next Steps
Code Generation
Learn about the code generation process and generated helpers
Well-Known Types
Explore enhanced Protocol Buffer types