Preview of the proposed up-rust native-frame-model branch (up-rust b6b99c6d, up-spec f0e9b17) — not released documentation. branch · write-up

Struct UFrameMetadata

Source
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

Source

pub fn publish(topic: UUri) -> UFrameMetadataBuilder

Starts building metadata for a publish frame on topic.

Source

pub fn notification(origin: UUri, destination: UUri) -> UFrameMetadataBuilder

Starts building metadata for a notification frame from origin to destination.

Source

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.

Source

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.

Source

pub fn kind(&self) -> FrameMessageKind

Returns the frame message kind.

Source

pub fn id(&self) -> &UUID

Returns the unique frame id.

Source

pub fn source(&self) -> &UUri

Returns the source address.

Source

pub fn sink(&self) -> Option<&UUri>

Returns the sink address, if present.

Source

pub fn reqid(&self) -> Option<&UUID>

Returns the correlated request id, if present.

Source

pub fn priority(&self) -> Option<FramePriority>

Returns the frame priority, if present.

Source

pub fn ttl(&self) -> Option<Duration>

Returns the time-to-live, if present.

Source

pub fn comm_status(&self) -> Option<UCode>

Returns the communication status, if present.

Source

pub fn permission_level(&self) -> Option<u32>

Returns the permission level, if present.

Source

pub fn token(&self) -> Option<&str>

Returns the access token, if present.

Source

pub fn traceparent(&self) -> Option<&str>

Returns the W3C traceparent, if present.

Source

pub fn payload_encoding(&self) -> Option<&PayloadEncoding>

Returns the native payload encoding, if one is present.

Source

pub fn into_payload_encoding(self) -> Option<PayloadEncoding>

Consumes this metadata and returns its native payload encoding.

Source

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.

Source

pub fn without_payload_encoding(self) -> Self

Returns metadata equal to self but without a payload encoding.

Source

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.

Source

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

Source§

fn clone(&self) -> UFrameMetadata

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UFrameMetadata

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for UFrameMetadata

Source§

fn eq(&self, other: &UFrameMetadata) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for UFrameMetadata

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<TCore> UWithNativePrefixWire for TCore

Source§

fn into_native_prefix_wire_transport<W>( self, wire: W, ) -> UWireTransport<TCore, W, NativePrefixFrameMetadataCodec>
where W: UWire,

Wraps this core with an external or custom selected wire using canonical metadata.
Source§

fn into_protobuf_transport( self, ) -> UWireTransport<TCore, ProtobufWire, NativePrefixFrameMetadataCodec>

Wraps this core with the Protocol Buffers selected-wire profile.
Source§

fn into_stable_container_transport( self, ) -> UWireTransport<TCore, StableContainerWireFormat, NativePrefixFrameMetadataCodec>

Wraps this core with the stable-container selected-wire profile.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more