embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

MscBlockDevice

Struct MscBlockDevice 

Source
pub struct MscBlockDevice<'lun, 'dev, 'd, A, M, ALIGN>
where A: UsbHostAllocator<'d>, M: RawMutex, ALIGN: Alignment,
{ /* private fields */ }
Expand description

block_device_driver::BlockDevice adapter for an MscLun.

Constructed by MscLun::as_block_device. The ALIGN type parameter picks the buffer alignment required by the caller (for example the DMA alignment of the downstream consumer). The BlockDevice trait is implemented for every SIZE — the LUN’s reported block size is validated on every call.

Trait Implementations§

Source§

impl<'lun, 'dev, 'd, A, M, ALIGN, const SIZE: usize> BlockDevice<SIZE> for MscBlockDevice<'lun, 'dev, 'd, A, M, ALIGN>
where A: UsbHostAllocator<'d>, M: RawMutex, ALIGN: Alignment,

Available on crate feature block-device-driver only.
Source§

type Error = MscError

The error type for the BlockDevice implementation.
Source§

type Align = ALIGN

The alignment requirements of the block buffers.
Source§

async fn read( &mut self, block_address: u32, data: &mut [Aligned<ALIGN, [u8; SIZE]>], ) -> Result<(), MscError>

Read one or more blocks at the given block address.
Source§

async fn write( &mut self, block_address: u32, data: &[Aligned<ALIGN, [u8; SIZE]>], ) -> Result<(), MscError>

Write one or more blocks at the given block address.
Source§

async fn size(&mut self) -> Result<u64, MscError>

Report the size of the block device in bytes.

Auto Trait Implementations§

§

impl<'lun, 'dev, 'd, A, M, ALIGN> !RefUnwindSafe for MscBlockDevice<'lun, 'dev, 'd, A, M, ALIGN>

§

impl<'lun, 'dev, 'd, A, M, ALIGN> !UnwindSafe for MscBlockDevice<'lun, 'dev, 'd, A, M, ALIGN>

§

impl<'lun, 'dev, 'd, A, M, ALIGN> Freeze for MscBlockDevice<'lun, 'dev, 'd, A, M, ALIGN>
where &'lun mut MscLun<'dev, 'd, A, M>: Freeze, PhantomData<fn() -> ALIGN>: Freeze,

§

impl<'lun, 'dev, 'd, A, M, ALIGN> Send for MscBlockDevice<'lun, 'dev, 'd, A, M, ALIGN>
where &'lun mut MscLun<'dev, 'd, A, M>: Send, PhantomData<fn() -> ALIGN>: Send,

§

impl<'lun, 'dev, 'd, A, M, ALIGN> Sync for MscBlockDevice<'lun, 'dev, 'd, A, M, ALIGN>
where &'lun mut MscLun<'dev, 'd, A, M>: Sync, PhantomData<fn() -> ALIGN>: Sync,

§

impl<'lun, 'dev, 'd, A, M, ALIGN> Unpin for MscBlockDevice<'lun, 'dev, 'd, A, M, ALIGN>
where &'lun mut MscLun<'dev, 'd, A, M>: Unpin, PhantomData<fn() -> ALIGN>: Unpin,

§

impl<'lun, 'dev, 'd, A, M, ALIGN> UnsafeUnpin for MscBlockDevice<'lun, 'dev, 'd, A, M, ALIGN>
where &'lun mut MscLun<'dev, 'd, A, M>: UnsafeUnpin, PhantomData<fn() -> ALIGN>: UnsafeUnpin,

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 = !

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.