Skip to main content

Dispatcher

Struct Dispatcher 

Source
pub struct Dispatcher<'a, T: Transport, S: Storage, B: BootMetaStore, C: BootCtl, const BUF: usize> {
    pub platform: &'a mut Platform<T, S, B, C>,
    pub frame: Frame,
    /* private fields */
}
Expand description

Protocol dispatcher with write buffering.

Incoming write data is accumulated in a ring buffer and flushed to storage in page-sized chunks using fast page programming. The host must send a Flush command to commit any remaining partial page before Verify, or before skipping to a non-sequential address.

Fields§

§platform: &'a mut Platform<T, S, B, C>

Mutable reference to the platform peripherals.

§frame: Frame

Reusable frame buffer.

Implementations§

Source§

impl<'a, T: Transport, S: Storage, B: BootMetaStore, C: BootCtl, const BUF: usize> Dispatcher<'a, T, S, B, C, BUF>

Source

pub fn new(platform: &'a mut Platform<T, S, B, C>) -> Self

Create a new dispatcher for the given platform.

Source

pub fn dispatch(&mut self) -> Result<(), ReadError>

Read a frame, dispatch the command, and send the response. Returns Err only for transport IO errors. Frame-level errors (bad CRC, invalid frame) are silently skipped.

Auto Trait Implementations§

§

impl<'a, T, S, B, C, const BUF: usize> Freeze for Dispatcher<'a, T, S, B, C, BUF>

§

impl<'a, T, S, B, C, const BUF: usize> RefUnwindSafe for Dispatcher<'a, T, S, B, C, BUF>

§

impl<'a, T, S, B, C, const BUF: usize> Send for Dispatcher<'a, T, S, B, C, BUF>
where T: Send, S: Send, B: Send, C: Send,

§

impl<'a, T, S, B, C, const BUF: usize> Sync for Dispatcher<'a, T, S, B, C, BUF>
where T: Sync, S: Sync, B: Sync, C: Sync,

§

impl<'a, T, S, B, C, const BUF: usize> Unpin for Dispatcher<'a, T, S, B, C, BUF>

§

impl<'a, T, S, B, C, const BUF: usize> UnsafeUnpin for Dispatcher<'a, T, S, B, C, BUF>

§

impl<'a, T, S, B, C, const BUF: usize> !UnwindSafe for Dispatcher<'a, T, S, B, C, BUF>

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.