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

Trait UWireMetadataCodec

Source
pub trait UWireMetadataCodec {
    const METADATA_LAYOUT_ID: WireIdentity = NATIVE_PREFIX_METADATA_LAYOUT_ID;

    // Required methods
    fn encode_frame_metadata(
        &self,
        context: UWireMetadataContext,
        metadata: &UFrameMetadata,
    ) -> Result<Vec<u8>, UWireMetadataError>;
    fn decode_frame_metadata(
        &self,
        context: UWireMetadataContext,
        src: &[u8],
    ) -> Result<UFrameMetadata, UWireMetadataError>;
}
Expand description

Explicit metadata codec used by selected-wire transport adapters.

Provided Associated Constants§

Source

const METADATA_LAYOUT_ID: WireIdentity = NATIVE_PREFIX_METADATA_LAYOUT_ID

Metadata byte-profile identity this codec writes and accepts.

Defaults to the legacy native-prefix protobuf layout for compatibility with pre-R2 external codecs; profile codecs override it. Codecs MUST overlay this identity onto the context they encode/decode with so that cross-profile decode fails as UWireMetadataError::UnknownMetadataLayoutId.

Required Methods§

Source

fn encode_frame_metadata( &self, context: UWireMetadataContext, metadata: &UFrameMetadata, ) -> Result<Vec<u8>, UWireMetadataError>

Encodes native frame metadata for the selected-wire context.

§Errors

Returns an error when metadata is invalid or cannot be serialized.

Source

fn decode_frame_metadata( &self, context: UWireMetadataContext, src: &[u8], ) -> Result<UFrameMetadata, UWireMetadataError>

Decodes and validates native frame metadata for the selected-wire context.

§Errors

Returns an error when bytes are malformed, use an unsupported layout or version, or declare an incompatible wire or payload family.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§