pub struct UFrameMetadata { /* private fields */ }Expand description
Canonical semantic metadata of a native uProtocol frame.
This is the model that owned frames (UOwnedFrame), zero-copy
frame views, and selected-wire metadata codecs reason about. It owns its
fields ergonomically (strings, options, Duration) because it is never
reinterpreted as raw bytes across processes or languages; fixed-layout
and byte-serialized representations are derived from it.
The frame’s payload presence is a property of the frame carrier
(UOwnedFrame, UFrameView, TX loan specs), not of the
metadata; the v1 invariant “payload present if and only if
payload_encoding is present” is enforced at those boundaries.
Implementations§
Source§impl UFrameMetadata
impl UFrameMetadata
Sourcepub fn publish(topic: UUri) -> UFrameMetadataBuilder
pub fn publish(topic: UUri) -> UFrameMetadataBuilder
Starts building metadata for a publish frame on topic.
Sourcepub fn notification(origin: UUri, destination: UUri) -> UFrameMetadataBuilder
pub fn notification(origin: UUri, destination: UUri) -> UFrameMetadataBuilder
Starts building metadata for a notification frame from origin to
destination.
Sourcepub fn request(
method: UUri,
reply_to: UUri,
ttl: Duration,
) -> UFrameMetadataBuilder
pub fn request( method: UUri, reply_to: UUri, ttl: Duration, ) -> UFrameMetadataBuilder
Starts building metadata for an RPC request frame invoking method,
with responses directed to reply_to.
Request frames require a TTL and default to FramePriority::CS4.
Sourcepub fn response(
invoked_method: UUri,
reply_to: UUri,
request_id: UUID,
) -> UFrameMetadataBuilder
pub fn response( invoked_method: UUri, reply_to: UUri, request_id: UUID, ) -> UFrameMetadataBuilder
Starts building metadata for an RPC response frame from invoked_method
to reply_to, correlated to the request with id request_id.
Response frames default to FramePriority::CS4.
Sourcepub fn kind(&self) -> FrameMessageKind
pub fn kind(&self) -> FrameMessageKind
Returns the frame message kind.
Sourcepub fn priority(&self) -> Option<FramePriority>
pub fn priority(&self) -> Option<FramePriority>
Returns the frame priority, if present.
Sourcepub fn comm_status(&self) -> Option<UCode>
pub fn comm_status(&self) -> Option<UCode>
Returns the communication status, if present.
Sourcepub fn permission_level(&self) -> Option<u32>
pub fn permission_level(&self) -> Option<u32>
Returns the permission level, if present.
Sourcepub fn traceparent(&self) -> Option<&str>
pub fn traceparent(&self) -> Option<&str>
Returns the W3C traceparent, if present.
Sourcepub fn payload_encoding(&self) -> Option<&PayloadEncoding>
pub fn payload_encoding(&self) -> Option<&PayloadEncoding>
Returns the native payload encoding, if one is present.
Sourcepub fn into_payload_encoding(self) -> Option<PayloadEncoding>
pub fn into_payload_encoding(self) -> Option<PayloadEncoding>
Consumes this metadata and returns its native payload encoding.
Sourcepub fn with_payload_encoding(
self,
payload_encoding: PayloadEncoding,
) -> Result<Self, UFrameMetadataError>
pub fn with_payload_encoding( self, payload_encoding: PayloadEncoding, ) -> Result<Self, UFrameMetadataError>
Returns metadata equal to self but carrying payload_encoding.
§Errors
Returns an error if the encoding or the resulting metadata is invalid.
Sourcepub fn without_payload_encoding(self) -> Self
pub fn without_payload_encoding(self) -> Self
Returns metadata equal to self but without a payload encoding.
Sourcepub fn validate(&self) -> Result<(), UFrameMetadataError>
pub fn validate(&self) -> Result<(), UFrameMetadataError>
Validates this metadata against the rules of its frame message kind.
§Errors
Returns an error if the metadata violates the rules for its kind, for
example a publish frame carrying a sink, a request frame without TTL,
or an RPC frame with a priority below FramePriority::CS4.
Sourcepub fn try_project_to_attributes(
&self,
) -> Result<UAttributes, UFrameMetadataError>
pub fn try_project_to_attributes( &self, ) -> Result<UAttributes, UFrameMetadataError>
Projects this metadata to legacy UAttributes.
This is a compatibility projection for UTransport-family (UMessage-shaped)
boundaries and is fallible by design only for fields that cannot be
represented by legacy types, such as a TTL that does not fit the
legacy 32-bit millisecond field. Open payload encodings are represented
by the UAttributes payload-encoding identity fields.
§Errors
Returns an error if the metadata is invalid or not representable.
Trait Implementations§
Source§impl Clone for UFrameMetadata
impl Clone for UFrameMetadata
Source§fn clone(&self) -> UFrameMetadata
fn clone(&self) -> UFrameMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more