Expand description
Low-level serialization and deserialization engine for mesh messages.
Most code won’t use this directly but will instead use one of the derive macros:
Protobuf— generates tagged protobuf encoding with explicit field numbers (#[mesh(N)]). Use for durable saved state that must be forward- and backward-compatible.MeshPayload(inmesh_derive) — generates positional encoding without field numbers. Use for internal runtime messages where compatibility across versions is not required.
§Wire format
The encoding is a superset of Protocol Buffers, allowing protobuf clients and mesh to interoperate for a subset of types. The extension adds a sideband resource channel for transferring OS resources (file descriptors, handles, ports) that cannot be serialized to bytes.
§Why not serde?
serde takes values by reference (&self), which makes it impossible to
transfer ownership of resources like ports, handles, and file descriptors.
mesh’s encoding takes values by value, consuming the source and producing
the value at the destination. This is the fundamental design difference
that enables mesh’s resource-transfer model.
§no_std support
This crate is no_std by default (with alloc). Enable the std feature
for additional functionality.
Modules§
- buffer
- Types to support writing to a contiguous byte buffer.
- encoding
- Protobuf encodings for Rust types.
- inplace
- Provides an
Option-like type for constructing values in place. - message
- Type-erased protobuf message support.
- oneof
- Encoding support for protobuf
oneoffields, which are derived from Rust enums. - prost
- Support for encoding Prost types as Mesh types.
- protobuf
- Tools to encode and decode protobuf messages.
- protofile
- Definitions for describing the format protobuf messages. These can be used
to generate
.protofiles that are binary compatible with the associated Rust types. - table
- Table-based message encoding and decoding.
- transparent
- Transparent encoding for types that are a wrapper around another type.
Macros§
- inplace
- Constructs a possibly-initialized
crate::inplace::InplaceOptionon the stack from anOption<T>. - inplace_
none - Constructs an uninitialized
crate::inplace::InplaceOptionon the stack. - inplace_
some - Constructs an initialized
crate::inplace::InplaceOptionon the stack from aT. - os_
resource - Implements
DefaultEncodingfor OS resources.
Structs§
- Encode
As - Wrapper type to easily support custom mesh encoding.
- Error
- A decoding error.
- Serialized
Message - A serialized message, consisting of binary data and a list of resources.
- Timestamp
- A timestamp representing a point in UTC time with nanosecond resolution.
Enums§
- NoResources
- An empty resources type, used when an encoding does not require any external resources (such as files or mesh channels).
Traits§
- Copy
Extend - Trait for collections that can be extended by a slice of
T: Copy. - Default
Encoding - Associates the default encoder/decoder type for converting an object to/from protobuf format.
- Described
Protobuf - Trait for types implementing
Protobufand having an associated protobuf message description. - Field
Decode - The
FieldEncodetrait provides a field decoder for typeT. - Field
Encode - The
FieldEncodetrait provides a field encoder for typeT. - Message
Decode - The
MessageEncodetrait provides a message decoder for typeT. - Message
Encode - The
MessageEncodetrait provides a message encoder for typeT. - Packed
Decode - Methods for decoding a packed field.
- Packed
Encode - Encoder methods for writing packed fields.
- Protobuf
- Trait for types that can be encoded and decoded as a protobuf message.
- Result
Ext - Extension trait to add type context to
Error.
Functions§
- decode
- Decodes a message with its default encoding.
- encode
- Encodes a message with its default encoding.
- merge
- Merges message fields into an existing message.
Type Aliases§
- Result
- A decoding result.