Skip to main content

XfsError

Enum XfsError 

Source
#[non_exhaustive]
pub enum XfsError { Truncated { structure: &'static str, need: usize, have: usize, }, BadMagic { found: u32, bytes: [u8; 4], }, UnsupportedDir { detail: String, }, PathNotFound { path: String, component: String, }, }
Expand description

Errors surfaced while parsing XFS on-disk structures.

Every variant names the offending value so an “unknown/invalid” report hands the investigator the evidence (raw bytes / offset), never a bare “invalid”.

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.
§

Truncated

The buffer was too small to hold the structure being parsed.

Fields

§structure: &'static str

Name of the structure that could not be read.

§need: usize

Minimum byte length required.

§have: usize

Byte length actually available.

§

BadMagic

The superblock magic number did not match XFSB (0x5846_5342).

Carries the four bytes actually found so the caller can identify what the image really is (fail-loud with the offending value).

Fields

§found: u32

The 32-bit big-endian value read at offset 0.

§bytes: [u8; 4]

The four raw bytes at offset 0.

§

UnsupportedDir

A directory used a format this reader does not yet handle (leaf / node / btree), or a block directory carried an unrecognized data-block magic.

Fail-loud rather than return an empty listing: detail names the format and the offending value (magic bytes / size), so the investigator sees what could not be read, never a silently-empty directory.

Fields

§detail: String

Human description naming the format and the offending value.

§

PathNotFound

A path component did not resolve during crate::read_by_path: the named component was not found in its parent directory, or a non-final component was not itself a directory. Carries the offending path and component.

Fields

§path: String

The full path being resolved.

§component: String

The specific component that failed to resolve.

Trait Implementations§

Source§

impl Debug for XfsError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for XfsError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for XfsError

Source§

impl Error for XfsError

1.30.0 · Source§

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
Source§

impl PartialEq for XfsError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for XfsError

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

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.