Crate protobuf

Source
Expand description

§Library to read and write protocol buffers data

§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-mapping implements JSON parsing and serialization for protobuf messages.
  • protobuf-codegen can be used to generate rust code from .proto crates.
  • protoc-bin-vendored contains protoc command packed into the crate.
  • protobuf-parse contains .proto file parser. Rarely need to be used directly, but can be used for mechanical processing of .proto files.

Modules§

descriptor
Generated file from google/protobuf/descriptor.proto
ext
Utilities to support “extension” fields.
plugin
Generated file from google/protobuf/compiler/plugin.proto
reflect
Reflection implementation for protobuf data
rt
Functions and types used by generated protobuf code
rustproto
Generated file from rustproto.proto
text_format
Protobuf “text format” implementation.
well_known_types
Generated code for “well known types”

Structs§

Chars
Thin wrapper around Bytes which guarantees that bytes are valid UTF-8 string. Should be API-compatible to String.
CodedInputStream
Buffered read with handy utilities.
CodedOutputStream
Buffered write with handy utilities
EnumOrUnknown
Protobuf enums with possibly unknown values are preserved in this struct.
Error
Error type for protobuf operations.
MessageField
Wrapper around Option<Box<T>>, convenient newtype.
SpecialFields
Special fields included in each generated message.
UnknownFields
Hold “unknown” fields in parsed message.
UnknownFieldsIter
Iterator over UnknownFields

Enums§

UnknownValue
Unknown value.
UnknownValueRef
Reference to unknown value.

Constants§

VERSION
protobuf crate version
VERSION_3_7_2
This symbol can be referenced to assert that proper version of crate is used

Traits§

Enum
Trait implemented by all protobuf enum types.
EnumFull
Trait is implemented for all enum types if lite runtime is not requested.
Message
Trait which is implemented by all generated message.
MessageDyn
Dynamic-dispatch version of either generated message or dynamic message.
MessageFull
Trait implemented for all the generated messages, except when lite runtime is enabled.
Oneof
Trait implemented by all oneof types in generated code.
OneofFull
Implemented by all oneof types when lite runtime is not enabled.

Type Aliases§

Result
Result alias for Error.