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§
Sourceconst METADATA_LAYOUT_ID: WireIdentity = NATIVE_PREFIX_METADATA_LAYOUT_ID
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§
Sourcefn encode_frame_metadata(
&self,
context: UWireMetadataContext,
metadata: &UFrameMetadata,
) -> Result<Vec<u8>, UWireMetadataError>
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.
Sourcefn decode_frame_metadata(
&self,
context: UWireMetadataContext,
src: &[u8],
) -> Result<UFrameMetadata, UWireMetadataError>
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.