Expand description
Library to read and write protocol buffers data
Version 3 is alpha
Currently developed branch of rust-protobuf is 3. It has the same spirit as version 2, but contains numerous improvements like:
- runtime reflection for mutability, not just for access
- protobuf text format and JSON parsing (which rely on reflection)
- dynamic message support: work with protobuf data without generating code from schema
- lite runtime codegen option now produces correct code without reflection support
Stable version of rust-protobuf will be supported until version 3 released.
Features
This crate has one feature, which is with-bytes.
with-bytes enables protobuf crate support for
bytes crate:
when parsing bytes or strings from bytes::Bytes,
protobuf will be able to reference the input instead of allocating subarrays.
Note, codegen also need to be instructed to generate Bytes or Chars for
bytes or string protobuf types instead of default Vec<u8> or String,
just enabling option on this crate is not enough.
See Customize struct in protobuf-codegen crate.
Accompanying crates
protobuf-json-mappingprotobuf-codegencan be used to rust code from.protocrates.protoc-bin-vendoredcontainsprotoccommand packed into the crate.protobuf-parsecontains.protofile parser. Rarely need to be used directly, but can be used for mechanical processing of.protofiles.
Modules
Generated file from google/protobuf/descriptor.proto
Utilities to support “extension” fields.
Generated file from google/protobuf/compiler/plugin.proto
Reflection implementation for protobuf data
Functions and types used by generated protobuf code
Generated file from rustproto.proto
Protobuf “text format” implementation.
Generated code for “well known types”
Structs
Thin wrapper around Bytes which guarantees that bytes are valid UTF-8 string.
Should be API-compatible to String.
Buffered read with handy utilities.
Buffered write with handy utilities
Protobuf enums with possibly unknown values are preserved in this struct.
Error type for protobuf operations.
Wrapper around Option<Box<T>>, convenient newtype.
Special fields included in each generated message.
Hold “unknown” fields in parsed message.
Iterator over UnknownFields
Enums
Unknown value.
Reference to unknown value.
Constants
protobuf crate version
This symbol can be referenced to assert that proper version of crate is used
Traits
Trait implemented by all protobuf enum types.
Trait is implemented for all enum types if lite runtime is not requested.
Trait which is implemented by all generated message.
Dynamic-dispatch version of either generated message or dynamic message.
Trait implemented for all the generated messages, except when lite runtime is enabled.
Trait implemented by all oneof types in generated code.
Implemented by all oneof types when lite runtime is not enabled.