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

Trait UFrameWireFormat

Source
pub trait UFrameWireFormat {
    // Required methods
    fn name() -> &'static str;
    fn content_type() -> &'static str;
    fn serialize_frame(frame: &UOwnedFrame) -> Result<Bytes, UFrameWireError>;
    fn deserialize_frame(src: &[u8]) -> Result<UOwnedFrame, UFrameWireError>;
}
Expand description

Whole-frame wire format for transporting a complete native uProtocol frame.

This is distinct from payload codecs, which only transform an application value into frame payload bytes. Implementations must preserve native frame metadata and payload presence. If an envelope cannot represent a native-only crate::PayloadEncoding, it should return UFrameWireError::UnsupportedPayloadEncoding instead of silently dropping metadata.

Required Methods§

Source

fn name() -> &'static str

Stable implementation name for logs, diagnostics, and configuration.

Source

fn content_type() -> &'static str

Media type of bytes emitted by Self::serialize_frame.

Source

fn serialize_frame(frame: &UOwnedFrame) -> Result<Bytes, UFrameWireError>

Serializes a complete native frame, including metadata and payload bytes.

§Errors

Returns an error if the frame is invalid or cannot be represented by this wire format.

Source

fn deserialize_frame(src: &[u8]) -> Result<UOwnedFrame, UFrameWireError>

Deserializes a complete native frame from this wire format’s bytes.

§Errors

Returns an error if src is malformed or violates native frame invariants.

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§