Trait MctpMedium

Source
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§

Source

type Frame: MctpMediumFrame<Self>

the medium specific header and trailer for the packet

Source

type Error: Debug + Copy + Clone + PartialEq + Eq

the error type for deserialization of the medium specific header

Source

type ReplyContext: Debug + Copy + Clone + PartialEq + Eq

Required Methods§

Source

fn max_message_body_size(&self) -> usize

the maximum transmission unit for the medium

Source

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

Source

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>,

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.

Implementors§