pub trait MctpMedium: Sized {
type Frame: MctpMediumFrame<Self>;
type Error: Debug + Copy + Clone + PartialEq + Eq;
type ReplyContext: Debug + Copy + Clone + PartialEq + Eq;
// Required methods
fn max_message_body_size(&self) -> usize;
fn deserialize<'buf>(
&self,
packet: &'buf [u8],
) -> MctpPacketResult<(Self::Frame, &'buf [u8]), Self>;
fn serialize<'buf, F>(
&self,
reply_context: Self::ReplyContext,
buffer: &'buf mut [u8],
message_writer: F,
) -> MctpPacketResult<&'buf [u8], Self>
where F: for<'a> FnOnce(&'a mut [u8]) -> MctpPacketResult<usize, Self>;
}Required Associated Types§
Sourcetype Frame: MctpMediumFrame<Self>
type Frame: MctpMediumFrame<Self>
the medium specific header and trailer for the packet
Sourcetype Error: Debug + Copy + Clone + PartialEq + Eq
type Error: Debug + Copy + Clone + PartialEq + Eq
the error type for deserialization of the medium specific header
type ReplyContext: Debug + Copy + Clone + PartialEq + Eq
Required Methods§
Sourcefn max_message_body_size(&self) -> usize
fn max_message_body_size(&self) -> usize
the maximum transmission unit for the medium
Sourcefn deserialize<'buf>(
&self,
packet: &'buf [u8],
) -> MctpPacketResult<(Self::Frame, &'buf [u8]), Self>
fn deserialize<'buf>( &self, packet: &'buf [u8], ) -> MctpPacketResult<(Self::Frame, &'buf [u8]), Self>
deserialize the packet into the medium specific header and remainder of the packet - this includes the mctp transport header, and mctp packet payload
Sourcefn serialize<'buf, F>(
&self,
reply_context: Self::ReplyContext,
buffer: &'buf mut [u8],
message_writer: F,
) -> MctpPacketResult<&'buf [u8], Self>
fn serialize<'buf, F>( &self, reply_context: Self::ReplyContext, buffer: &'buf mut [u8], message_writer: F, ) -> MctpPacketResult<&'buf [u8], Self>
serialize the packet into the medium specific header and the payload
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.