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§
Sourcefn content_type() -> &'static str
fn content_type() -> &'static str
Media type of bytes emitted by Self::serialize_frame.
Sourcefn serialize_frame(frame: &UOwnedFrame) -> Result<Bytes, UFrameWireError>
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.
Sourcefn deserialize_frame(src: &[u8]) -> Result<UOwnedFrame, UFrameWireError>
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.