capsules_core::virtualizers::virtual_flash

Struct FlashUser

Source
pub struct FlashUser<'a, F: Flash + 'static> { /* private fields */ }
Expand description

Keeps state for each flash user.

All uses of the virtualized flash interface need to create one of these to be a user of the flash. The new() function handles most of the work, a user only has to pass in a reference to the MuxFlash object.

Implementations§

Source§

impl<'a, F: Flash> FlashUser<'a, F>

Source

pub fn new(mux: &'a MuxFlash<'a, F>) -> FlashUser<'a, F>

Trait Implementations§

Source§

impl<F: Flash> Client<F> for FlashUser<'_, F>

Source§

fn read_complete( &self, pagebuffer: &'static mut F::Page, result: Result<(), Error>, )

Flash read complete.
Source§

fn write_complete( &self, pagebuffer: &'static mut F::Page, result: Result<(), Error>, )

Flash write complete.
Source§

fn erase_complete(&self, result: Result<(), Error>)

Flash erase complete.
Source§

impl<F: Flash> Flash for FlashUser<'_, F>

Source§

type Page = <F as Flash>::Page

Type of a single flash page for the given implementation.
Source§

fn read_page( &self, page_number: usize, buf: &'static mut Self::Page, ) -> Result<(), (ErrorCode, &'static mut Self::Page)>

Read a page of flash into the buffer.
Source§

fn write_page( &self, page_number: usize, buf: &'static mut Self::Page, ) -> Result<(), (ErrorCode, &'static mut Self::Page)>

Write a page of flash from the buffer.
Source§

fn erase_page(&self, page_number: usize) -> Result<(), ErrorCode>

Erase a page of flash by setting every byte to 0xFF.
Source§

impl<'a, F: Flash, C: Client<Self>> HasClient<'a, C> for FlashUser<'a, F>

Source§

fn set_client(&'a self, client: &'a C)

Set the client for this flash peripheral. The client will be called when operations complete.
Source§

impl<'a, F: Flash> ListNode<'a, FlashUser<'a, F>> for FlashUser<'a, F>

Source§

fn next(&'a self) -> &'a ListLink<'a, FlashUser<'a, F>>

Auto Trait Implementations§

§

impl<'a, F> !Freeze for FlashUser<'a, F>

§

impl<'a, F> !RefUnwindSafe for FlashUser<'a, F>

§

impl<'a, F> !Send for FlashUser<'a, F>

§

impl<'a, F> !Sync for FlashUser<'a, F>

§

impl<'a, F> Unpin for FlashUser<'a, F>

§

impl<'a, F> !UnwindSafe for FlashUser<'a, F>

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.