Expand description
up-rust is the Rust language library for Eclipse uProtocol™ — a protocol that lets software components (in vehicles and beyond) publish data, subscribe to it, and call each other’s services over whatever messaging technology a deployment happens to use: MQTT, Zenoh, DDS, shared memory, and more.
The idea in one sentence: you write against one small messaging API, and the technology underneath stays swappable.
§Your first message
use up_rust::{UMessageBuilder, UPayloadFormat, UTransport, UUri};
async fn publish_engine_temp(transport: &dyn UTransport) -> Result<(), Box<dyn std::error::Error>> {
// Every message has a source address: authority / entity / version / resource.
let topic = UUri::try_from_parts("my-vehicle", 0x1_0001, 1, 0x8001)?;
let message = UMessageBuilder::publish(topic)
.build_with_payload("92.5", UPayloadFormat::Text)?;
transport.send(message).await?;
Ok(())
}That is the whole application-side model: build a UMessage, hand it to
a UTransport someone has configured, done. Receiving is the mirror
image — register a UListener for the addresses you care about.
§Which reader are you?
| You want to… | Start at | Cargo features |
|---|---|---|
| Write an application — publish, subscribe, or call/serve RPC | The role traits in communication: Publisher, Subscriber, Notifier, RpcClient, RpcServer — ready-made on top of any transport | communication |
| Connect a messaging technology — make uProtocol run over your broker/bus | UTransport (start here), then the guide’s transport chapter for the richer frame-based options | transport-implementer-api |
| Add a payload encoding — carry a new serialization format efficiently | The guide’s wire chapter and wire_implementer_api | wire-implementer-api |
| Move large payloads without copies — camera frames, LiDAR scans, big tables | The typed path in the transport chapter (apps) or the zero-copy tutorial (transports) | zero-copy-transport (+ your side’s feature above) |
The guide walks each path end to end with code.
§Five words you’ll meet everywhere
- uEntity — any software component that talks uProtocol (an app, a service, a sensor feed).
- Transport Layer (“up-L1”) — the layer that physically moves message bytes; a transport is one implementation of it (Zenoh, MQTT, DDS, …).
- Communication Layer (“up-L2”) — the friendly role API (publish/subscribe/RPC) built on top of any transport.
- Wire format — how a payload is encoded into bytes (protobuf, CDR, Arrow, …). Wires and transports are independent: any wire can ride any capable transport.
- Zero-copy loan — for large payloads, a transport can lend you its own transmit buffer so you write data exactly once, directly where it will be sent from. The receive side hands payloads out the same way, as read-only leases.
§Module map
communication— the up-L2 roles most applications use.umessage,uri,uattributes— the core message model.utransport— the up-L1 contract transports implement.wireandpayload— wire identities and payload codecs.frame— the validated frame model advanced transports exchange.guide— tutorials for every audience above.
§Features
No feature is enabled by default; enable what your role needs. Each feature below silently enables everything it requires. Constrained publish-only builds need no feature at all: use the Transport Layer directly — it’s the first example above, and it carries no protobuf and no tokio. No documented features in Cargo.toml
§References
Re-exports§
pub use local_transport::LocalTransport;pub use frame::metadata::FrameMessageKind;pub use frame::metadata::FramePriority;pub use frame::metadata::PayloadEncoding;pub use frame::metadata::UFrameMetadata;pub use frame::metadata::UFrameMetadataError;pub use frame::validate_frame_view_for_transport;pub use frame::UFrameView;pub use payload::UWireError;pub use frame::envelope::UFrameWireError;pub use frame::envelope::UFrameWireFormat;pub use payload::codec::DecodePayload;pub use payload::codec::EncodePayload;pub use payload::codec::PayloadCodec;pub use payload::codec::PayloadFormat;pub use payload::codec::PayloadLayout;pub use payload::codec::ProtobufPayload;pub use payload::codec::ReadDecodePayload;pub use payload::loan::LoanPayload;pub use payload::loan::LoanUninitPayload;pub use payload::loan::LoanedInitPayload;pub use payload::loan::LoanedUninitPayload;pub use payload::stable::assert_stable_payload_byte_backed_uninit;pub use payload::stable::stable_payload_supports_byte_backed_uninit;pub use payload::stable::ByteBackedStablePayload;pub use payload::stable::InitializedStablePayload;pub use payload::stable::StableContainerPayload;pub use payload::stable::StableContainerPayloadInfo;pub use payload::stable::StablePayload;pub use payload::stable::StablePayloadInit;pub use payload::stable::StablePayloadInitContext;pub use wire::NativePrefixFrameMetadataCodec;pub use wire::ProtobufWire;pub use wire::StableContainerWireFormat;pub use wire::UProtocolNativeWire;pub use wire::WireCompatibility;pub use wire::WireIdentity;pub use wire::WireIdentityRef;pub use wire::NATIVE_EXPLICIT_PAYLOAD_FAMILY_ID;pub use wire::NATIVE_PREFIX_METADATA_LAYOUT_ID;pub use wire::PROTOBUF_PAYLOAD_FAMILY_ID;pub use wire::PROTOBUF_WIRE_ID;pub use wire::STABLE_CONTAINER_PAYLOAD_FAMILY_ID;pub use wire::STABLE_CONTAINER_WIRE_ID;pub use wire::UFRAME_FIELDS_METADATA_LAYOUT_ID;pub use wire::UPROTOCOL_NATIVE_WIRE_ID;pub use wire::XCDR_V2_PAYLOAD_FAMILY_ID;pub use wire::XCDR_V2_WIRE_ID;pub use wire::UWire;pub use wire::UWireDecode;pub use wire::UWireEncode;pub use wire::UWirePayload;pub use wire::UWireReadDecode;pub use wire::UWireMetadataCodec;pub use wire::UWireMetadataCodecFor;pub use wire::UWireMetadataContext;pub use wire::UWireMetadataError;pub use wire_transport::UEncodedRxFrame;pub use wire_transport::USelectedWireZeroCopyTransport;pub use wire_transport::UWireTransport;pub use wire_transport::EncodedOwnedFrame;pub use wire_transport::PreparedOwnedFrame;pub use wire_transport::UEncodedOwnedListener;pub use wire_transport::UOwnedTransportCore;pub use wire_transport::PreparedTxLoanSpec;pub use wire_transport::UEncodedLoanedRxFrame;pub use wire_transport::UEncodedZeroCopyListener;pub use wire_transport::UZeroCopyTransportCore;pub use wire_transport::UZeroCopyUninitTransportCore;pub use wire_transport::ProtobufWireTransport;pub use wire_transport::StableContainerWireTransport;pub use wire_transport::UNativePrefixWireTransport;pub use wire_transport::UWithNativePrefixWire;pub use wire_transport::UHasWire;pub use wire_transport::UWireRx;
Modules§
- bench_
fixtures - Cross-crate benchmark and contract-test fixtures (plumbing).
- communication
- Traits representing uProtocol’s Communication Layer API for publishing and subscribing to topics and for invoking RPC methods. Also contains default implementations of the traits employing uProtocol’s Transport & Session Layer API.
- core
- Default client implementations for interacting with uProtocol’s Core entities.
- frame
- The native frame data model: metadata, canonical field-block codec, and the read-side frame view contract.
- guide
- Guide: tutorials for every audience
- local_
transport - Provides an implementation of uProtocol’s Transport & Session Layer API which can be used for connecting uEntities that are running in the same process.
- payload
- Payload codec contracts shared by the frame families.
- selected_
wire_ user_ api - Compatibility import surface for selected-wire users.
- symphony
- Types and helpers that allow implementing an Eclipse Symphony™ Target Provider as a uService
exposed via the Communication Layer API’s
RpcServer. - test_
support - Test, fake, proof, and fixture support. These are not production transport evidence.
- transport_
implementer_ api - Compatibility import surface for transport implementers.
- wire
- Selected-wire identities, payload codecs, and metadata profiles.
- wire_
implementer_ api - Compatibility import surface for wire-format implementers.
- wire_
transport - Selected-wire transport adapter core.
Macros§
- bind_
wire_ self_ codec - Binds payload types to a wire whose marker is its own codec
(
Codec = Self), removing the most repetitive line of an all-in-one wire implementation.
Structs§
- Cloud
Event - Comparable
Listener - A wrapper type that allows comparing
UListeners to each other. - ExactU
Uri - A
UUrithat has been checked to contain no wildcard components. - InMemory
Owned Transport - In-memory owned-frame transport for unit tests, examples, and guide doctests.
- InMemory
Zero Copy Transport - In-memory zero-copy transport for tests and examples.
- Loaned
Payload - Immutable payload bytes with explicit transport-loan provenance.
- Loaned
Payload Uninit Mut - Mutable uninitialized payload bytes with explicit transport-loan provenance.
- Mock
Local UriProvider - A factory for URIs representing this uEntity’s resources.
- Mock
Transport - This extra struct is necessary in order to comply with mockall’s requirements regarding the parameter lifetimes see https://github.com/asomers/mockall/issues/571
- MockU
Listener - A handler for processing uProtocol messages.
- Notification
Builder State - The item.
- Notification
Validator - Validates attributes describing a Notification message.
- Payload
Alignment - Validated visible application payload alignment in bytes.
- Publish
Builder State - The item.
- Publish
Validator - Validates attributes describing a Publish message.
- Request
Builder State - The item.
- Request
Validator - Validate
UAttributeswith typeUMessageType::Request - Response
Builder State - The item.
- Response
Validator - Validate
UAttributeswith typeUMessageType::Response - Serialization
Error - Error produced when a value cannot be serialized or deserialized.
- Static
UriProvider - A URI provider that is statically configured with the uEntity’s authority, entity ID and version.
- UAny
- Minimal
google.protobuf.Anycarrier: a type URL plus serialized bytes. - UAttributes
- Message metadata: addressing, identity, type, and delivery options for one
UMessage. - UMessage
- One uProtocol message: attributes plus optional payload bytes.
- UMessage
Builder - A builder for creating
UMessages. - UOwned
Frame - Owned, serialization-neutral native uProtocol frame.
- UStatus
- Operation status: a
UCodewith optional message and details. - UTxLoan
Spec - Validated transport-independent transmit loan specification.
- UUID
- A uProtocol UUIDv7 message identifier (RFC 9562 layout).
- UUri
- A URI that represents a uProtocol resource identifier.
- UVec
RxLease - In-memory receive lease for tests and examples that need receive-lease shape.
- UVec
TxBuffer - Owned buffer useful for tests, examples, and adapters that emulate a transmit loan.
- UVec
Uninit TxBuffer - Owned uninitialized buffer useful for tests and examples.
Enums§
- Payload
Loan Provenance - Diagnostic provenance for loan-backed payload storage.
- UAttributes
Error - Errors produced when building or validating
UAttributes. - UAttributes
Validators - Enum that hold the implementations of uattributesValidator according to type.
- UCode
- Canonical status codes for uProtocol operations.
- UMessage
Error - Errors produced when building or converting a
UMessage. - UMessage
Type - The four uProtocol message kinds.
- UPayload
Format - Payload serialization formats defined by the uProtocol specification.
- UPriority
- QoS priority classes defined by the uProtocol specification.
- UTxPayload
Spec - Payload presence and layout requested for a transmit loan.
- UUri
Error - An error indicating a problem with creating or parsing a UUri.
- Unvalidated
- Typestate marker: not yet validated.
- Validated
- Typestate marker: validation has passed.
Constants§
- CONTENT_
TYPE_ CLOUDEVENTS_ PROTOBUF - MIME content type for protobuf-encoded CloudEvents.
Traits§
- Builder
State - Represents the type of message being built by a UMessageBuilder.
This is used to limit the available builder functions and to ensure that the
builder is used in a consistent way.
For example, only a builder for a request message can set the
permission_levelandtokenattributes and only a builder for a response message can set thecomm_statusandrequest_idattributes. This is achieved by having different builder state types for each message type and by using the BuilderState::merge_into_attributes function to add the state-specific attributes to the final message attributes when building the message. - Local
UriProvider - A factory for URIs representing this uEntity’s resources.
- Protobuf
Mappable - Role: standalone utility letting protobuf-generated types ride as payloads implicitly; blanket-implemented for
protobuftypes — see the trait map. - UAttributes
Validator - Role: standalone utility validating message attributes per message kind; used by transports at boundaries — see the trait map.
- UListener
- A handler for processing uProtocol messages.
- ULoaned
Contiguous Zero Copy RxFrame - Role: a receive lease over contiguous loan-backed storage; lets typed payloads be borrowed without copying — see the trait map.
- UOwned
Listener - Role: implemented by applications to receive owned frames — see the trait map.
- UOwned
Transport - Experimental serialization-neutral owned native-frame transport API.
- UOwned
Transport Impl - Role: implemented by transports offering the owned-frame family; users call
UOwnedTransport— see the trait map. - UTransport
- The uProtocol Transport Layer interface that provides a common API for uEntity developers to send and receive messages.
- UTxBuffer
- Role: transmit storage a zero-copy transport lends; write the payload in place, then commit — see the trait map.
- UUninit
TxBuffer - Role: an uninitialized transmit loan; filled safely via the typed init API — see the trait map.
- UZero
Copy Listener - Role: implemented by applications to receive zero-copy leases — see the trait map.
- UZero
Copy RxLease - Role: a received payload read in place; dropping it returns the storage — see the trait map.
- UZero
Copy Transport - Role: called by users of the zero-copy family; transports implement
UZeroCopyTransportImplor the encoded core instead — see the trait map. - UZero
Copy Transport Ext - Role: free blanket methods on every zero-copy transport; never implemented by hand — see the trait map.
- UZero
Copy Transport Impl - Role: implemented by transports whose API speaks the library’s frame types; users call
UZeroCopyTransport— see the trait map. - UZero
Copy Uninit Transport - Role: called by users to obtain uninitialized loans; transports implement
UZeroCopyUninitTransportImpl— see the trait map. - UZero
Copy Uninit Transport Ext - Role: free blanket methods for typed initialization into uninitialized loans; never implemented by hand — see the trait map.
- UZero
Copy Uninit Transport Impl - Role: implemented by transports that can lend uninitialized storage — see the trait map.
Functions§
- validate_
tx_ buffer_ for_ transport - Validates a transmit buffer before committing it through a public zero-copy boundary.
- verify_
filter_ criteria - Verifies that given UUris can be used as source and sink filter UUris for registering listeners.
- verify_
tx_ buffer_ payload_ layout - Verifies the visible transmit payload layout exposed by a zero-copy loan.
- verify_
uninit_ tx_ buffer_ payload_ layout - Verifies the visible uninitialized transmit payload layout exposed by a loan.
Derive Macros§
- Byte
Backed Stable Payload - Derives for stable payload types.
Derives
ByteBackedStablePayload: marks every byte pattern of the type as valid. - Stable
Payload - Derives for stable payload types.
Derives
StablePayload: a fixed-layout type whose bytes are stable across processes. - Stable
Payload Init - Derives for stable payload types.
Derives
StablePayloadInit: a typestate initializer that writes the type into uninitialized storage field by field.