Expand description
Core types and data structures for the Offline Protocol SDK.
This crate provides the fundamental types used throughout the SDK:
- Message types and identifiers
- Protocol types (UserId, AppId, TTL, etc.)
- Error types
All types in this crate are 100% safe Rust with no unsafe blocks.
§Building without std
This crate compiles for bare-metal targets with --no-default-features,
which is how a constrained leaf node (a Cortex-M lock or sensor that speaks
the protocol but cannot host the engine) links it. alloc is required in
both configurations.
What the std feature adds is everything that mints state from the
platform, because a bare-metal target supplies none of it: a clock
(Timestamp::now, WallClockTimestamp::now, LocalInstant), an
entropy source (MessageId::new, and so Message::new and
Message::builder with it), and threads (the sync module’s
poison-recovering lock helpers). Everything that parses, validates,
re-encodes or compares is present in both configurations, which is the half
a leaf node actually needs: it receives a frame someone else minted.
Construct messages from wire-supplied parts on the no_std path, via
MessageId::from_bytes, Timestamp::from_millis and the struct
literal, rather than the now()/new() constructors.
Re-exports§
pub use address::Address;pub use address::AddressError;pub use error::Error;pub use error::Result;pub use message::ContentType;pub use message::ForwardInfo;pub use message::MediaMetadata;pub use message::Message;pub use message::MessageId;pub use message::MessagePriority;pub use message::ReplyContext;pub use message::WireCodec;pub use service::ServiceDescriptor;pub use service::ServiceId;pub use sync::MutexExt;pub use sync::RwLockExt;pub use types::LocalInstant;pub use types::validate_id_chars;pub use types::AppId;pub use types::HopCount;pub use types::IdValidationError;pub use types::LamportClock;pub use types::MetadataMap;pub use types::Timestamp;pub use types::UserId;pub use types::WallClockTimestamp;pub use types::MAX_ID_LEN;pub use types::TTL;pub use username::contains_control_or_format;pub use username::Username;pub use username::UsernameError;pub use wire::WIRE_V1_MAGIC;pub use wire::WIRE_VERSION_V1;
Modules§
- address
- Self-certifying protocol addresses.
- error
- Error types for the Offline Protocol SDK.
- message
- Message types and structures.
- service
- Service discovery types for the Offline Protocol SDK.
- sync
- Poison-recovering lock extensions.
- types
- Core protocol types.
- username
- Normalized username claims.
- wire
- Compact binary wire codec for
Message(wire format v1).