Expand description
Protocol Buffers well-known types.
Note that the documentation for the types defined in this crate are generated from the Protobuf definitions, so code examples are not in Rust.
See the Protobuf reference for more information about well-known types.
§Any
The well-known Any
type contains an arbitrary serialized message along with a URL that
describes the type of the serialized message. Every message that also implements Name
can be serialized to and deserialized from Any
.
§Serialization
A message can be serialized using Any::from_msg
.
let message = Timestamp::date(2000, 1, 1).unwrap();
let any = Any::from_msg(&message).unwrap();
§Deserialization
A message can be deserialized using Any::to_msg
.
let message = any.to_msg::<Timestamp>().unwrap();
§Feature Flags
std
: Enable integration with standard library. Disable this feature forno_std
support. This feature is enabled by default.arbitrary
: Enable integration with cratearbitrary
. All types on this crate will implementtrait Arbitrary
.
Modules§
- compiler
- descriptor_
proto - Nested message and enum types in
DescriptorProto
. - enum_
descriptor_ proto - Nested message and enum types in
EnumDescriptorProto
. - field
- Nested message and enum types in
Field
. - field_
descriptor_ proto - Nested message and enum types in
FieldDescriptorProto
. - field_
options - Nested message and enum types in
FieldOptions
. - file_
options - Nested message and enum types in
FileOptions
. - generated_
code_ info - Nested message and enum types in
GeneratedCodeInfo
. - method_
options - Nested message and enum types in
MethodOptions
. - source_
code_ info - Nested message and enum types in
SourceCodeInfo
. - uninterpreted_
option - Nested message and enum types in
UninterpretedOption
. - value
- Nested message and enum types in
Value
.
Structs§
- Any
Any
contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message.- Api
- Api is a light-weight descriptor for an API Interface.
- Descriptor
Proto - Describes a message type.
- Duration
- A Duration represents a signed, fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like “day” or “month”. It is related to Timestamp in that the difference between two Timestamp values is a Duration and it can be added or subtracted from a Timestamp. Range is approximately +-10,000 years.
- Enum
- Enum type definition.
- Enum
Descriptor Proto - Describes an enum type.
- Enum
Options - Enum
Value - Enum value definition.
- Enum
Value Descriptor Proto - Describes a value within an enum.
- Enum
Value Options - Extension
Range Options - Field
- A single field of a message type.
- Field
Descriptor Proto - Describes a field within a message.
- Field
Mask FieldMask
represents a set of symbolic field paths, for example:- Field
Options - File
Descriptor Proto - Describes a complete .proto file.
- File
Descriptor Set - The protocol compiler can output a FileDescriptorSet containing the .proto files it parses.
- File
Options - Each of the definitions above may have “options” attached. These are just annotations which may cause code to be generated slightly differently or may contain hints for code that manipulates protocol messages.
- Generated
Code Info - Describes the relationship between generated code and its original source file. A GeneratedCodeInfo message is associated with only one generated source file, but may contain references to different source .proto files.
- List
Value ListValue
is a wrapper around a repeated field of values.- Message
Options - Method
- Method represents a method of an API interface.
- Method
Descriptor Proto - Describes a method of a service.
- Method
Options - Mixin
- Declares an API Interface to be included in this interface. The including interface must redeclare all the methods from the included interface, but documentation and options are inherited as follows:
- Oneof
Descriptor Proto - Describes a oneof.
- Oneof
Options - Option
- A protocol buffer option, which can be attached to a message, field, enumeration, etc.
- Service
Descriptor Proto - Describes a service.
- Service
Options - Source
Code Info - Encapsulates information about the original source file from which a FileDescriptorProto was generated.
- Source
Context SourceContext
represents information about the source of a protobuf element, like the file in which it is defined.- Struct
Struct
represents a structured data value, consisting of fields which map to dynamically typed values. In some languages,Struct
might be supported by a native representation. For example, in scripting languages like JS a struct is represented as an object. The details of that representation are described together with the proto support for the language.- Timestamp
- A Timestamp represents a point in time independent of any time zone or local calendar, encoded as a count of seconds and fractions of seconds at nanosecond resolution. The count is relative to an epoch at UTC midnight on January 1, 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar backwards to year one.
- Type
- A protocol buffer message type.
- Uninterpreted
Option - A message representing a option the parser does not recognize. This only appears in options protos created by the compiler::Parser class. DescriptorPool resolves these when building Descriptor objects. Therefore, options protos in descriptor objects (e.g. returned by Descriptor::options(), or produced by Descriptor::CopyTo()) will never have UninterpretedOptions in them.
- Value
Value
represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of these variants. Absence of any variant indicates an error.
Enums§
- Duration
Error - A duration handling error.
- Null
Value NullValue
is a singleton enumeration to represent the null value for theValue
type union.- Syntax
- The syntax in which a protocol buffer element is defined.
- Timestamp
Error - A timestamp handling error.