Struct MctpUsbHandler

Source
pub struct MctpUsbHandler { /* private fields */ }

Implementations§

Source§

impl MctpUsbHandler

Source

pub fn new() -> Self

Source

pub fn decode(xfer: &[u8]) -> Result<(&[u8], &[u8])>

Returns (mctp_packet, remainder).

xfer an input buffer, starting at a MCTP over USB header and containing at least one MCTP packet. mctp_packet is the portion after the MCTP over USB header. remainder is the remaining portion of xfer (which can be passed to a subsequent decode() call).

Source

pub fn receive<'f>( xfer: &[u8], mctp: &'f mut Stack, ) -> Result<Option<(MctpMessage<'f>, ReceiveHandle)>>

Source

pub fn send_fill<F>( &mut self, eid: Eid, typ: MsgType, tag: Option<Tag>, ic: MsgIC, cookie: Option<AppCookie>, xfer: &mut impl MctpUsbXfer, mctp: &mut Stack, fill_msg: F, ) -> SendOutput<'_>
where F: FnOnce(&mut Vec<u8, MAX_PAYLOAD>) -> Option<()>,

Source

pub fn header(mctp_len: usize, hdr: &mut [u8]) -> Result<()>

Creates a MCTP over USB Header.

mctplen is the length of the remaining MCTP packet after the header. hdr must be a 4 byte slice.

Trait Implementations§

Source§

impl Default for MctpUsbHandler

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.