Struct WearCheck
pub(crate) struct WearCheck {
last: Last,
}Expand description
Decides which failing blocks are worn and marks them bad.
A chip with active write protection fails every erase with EIO, just like a worn block. A failed block only counts as worn if the block tried right before or right after it worked. A second failure in a row is returned as an error. A protected chip loses at most one block.
Fields§
§last: LastImplementations§
§impl WearCheck
impl WearCheck
pub(crate) fn worked(&mut self, flash: &dyn Flash) -> Result<(), DeviceError>
pub(crate) fn worked(&mut self, flash: &dyn Flash) -> Result<(), DeviceError>
Records that the last tried block worked.
pub(crate) fn failed(
&mut self,
flash: &dyn Flash,
block: u32,
err: DeviceError,
) -> Result<(), DeviceError>
pub(crate) fn failed( &mut self, flash: &dyn Flash, block: u32, err: DeviceError, ) -> Result<(), DeviceError>
Records that block failed with err.
Returns Ok if the caller should go on with the next block.
pub(crate) fn finish(&mut self) -> Result<(), DeviceError>
pub(crate) fn finish(&mut self) -> Result<(), DeviceError>
Returns the error of the last failed block if no block confirmed it.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for WearCheck
impl !UnwindSafe for WearCheck
impl Freeze for WearCheck
impl Send for WearCheck
impl Sync for WearCheck
impl Unpin for WearCheck
impl UnsafeUnpin for WearCheck
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more