Skip to main content

DeviceError

Enum DeviceError 

#[non_exhaustive]
pub enum DeviceError {
Show 16 variants PartitionTable(Error), PartitionEntry { line: String, }, PartitionNotFound { name: String, }, Open { path: PathBuf, source: Error, }, Info(Error), Geometry { size: u64, block_size: u32, page_size: u32, }, BlockOutOfRange { block: u32, }, BufferLength { len: usize, }, BadBlockCheck { block: u32, source: Error, }, MarkBad { block: u32, source: Error, }, Erase { block: u32, source: Error, }, Read { block: u32, source: Error, }, Uncorrectable { block: u32, }, Write { block: u32, source: Error, }, Verify { block: u32, }, NoSpace,
}
Expand description

Failure of an MTD operation.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

PartitionTable(Error)

Reading the partition table in /proc/mtd failed.

§

PartitionEntry

A line in /proc/mtd isn’t a valid partition entry.

Fields

§line: String

The line that failed to parse.

§

PartitionNotFound

No MTD partition has the requested name.

Fields

§name: String

The requested name.

§

Open

Opening a device file failed.

Fields

§path: PathBuf

The device file.

§source: Error

The error of the open call.

§

Info(Error)

Querying the geometry of the MTD device failed.

§

Geometry

The MTD device reports a geometry this crate can’t handle.

Fields

§size: u64

The size of the device in bytes.

§block_size: u32

The erase block size in bytes.

§page_size: u32

The page size in bytes.

§

BlockOutOfRange

The block is beyond the end of the device.

Fields

§block: u32

The requested block.

§

BufferLength

A buffer exceeds a block, or a write buffer doesn’t end on a page.

Fields

§len: usize

The length of the buffer.

§

BadBlockCheck

Checking a block for the bad block marker failed.

Fields

§block: u32

The checked block.

§source: Error

The error of the ioctl.

§

MarkBad

Marking a block bad failed.

Fields

§block: u32

The block to mark.

§source: Error

The error of the ioctl.

§

Erase

Erasing a block failed.

Fields

§block: u32

The block to erase.

§source: Error

The error of the ioctl.

§

Read

Reading a block failed.

Fields

§block: u32

The block to read.

§source: Error

The error of the read.

§

Uncorrectable

A block contains bit errors that ECC can’t correct.

Fields

§block: u32

The block that was read.

§

Write

Writing a block failed.

Fields

§block: u32

The block to write.

§source: Error

The error of the write.

§

Verify

A block doesn’t contain the data that was written to it.

Fields

§block: u32

The written block.

§

NoSpace

No good block is left on the device.

Implementations§

§

impl DeviceError

pub(crate) fn is_media_failure(&self) -> bool

Returns whether the error means that the block itself is failing.

Trait Implementations§

§

impl Debug for DeviceError

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Display for DeviceError

§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Error for DeviceError

§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.