Skip to main content

NtfsError

Enum NtfsError 

Source
pub enum NtfsError {
Show 18 variants TooShort { what: &'static str, need: usize, got: usize, }, BadOemId([u8; 8]), BadBytesPerSector(u16), BadSectorsPerCluster(u8), BadRecordSize(u8), BadIndexRecordSize(u8), BadRecordSignature([u8; 4]), FixupMismatch { sector: usize, expected: u16, found: u16, }, BadUpdateSequence(&'static str), BadAttribute { offset: usize, detail: &'static str, }, BadRunlist(&'static str), BadIndex(&'static str), BadCompression(&'static str), BadAttributeList(&'static str), NotFound(String), NotADirectory(String), TooLarge { bytes: u64, }, Io(Error),
}
Expand description

Errors produced while parsing NTFS structures.

Variants§

§

TooShort

The input slice was shorter than the structure requires.

Fields

§what: &'static str
§need: usize
§got: usize
§

BadOemId([u8; 8])

The OEM ID at offset 3 was not b"NTFS ".

§

BadBytesPerSector(u16)

Bytes-per-sector is not a power of two in the range 256..=4096.

§

BadSectorsPerCluster(u8)

Sectors-per-cluster is zero or not a power of two.

§

BadRecordSize(u8)

The clusters-per-file-record-segment byte encodes an out-of-range size.

§

BadIndexRecordSize(u8)

The clusters-per-index-buffer byte encodes an out-of-range size.

§

BadRecordSignature([u8; 4])

An MFT record’s signature was neither FILE nor BAAD.

§

FixupMismatch

An update-sequence fixup did not match the Update Sequence Number — the record was torn across a sector boundary, or has been tampered with.

Fields

§sector: usize
§expected: u16
§found: u16
§

BadUpdateSequence(&'static str)

The update sequence array is malformed (offset/count out of bounds).

§

BadAttribute

An attribute is corrupt or would read out of bounds — rejected rather than trusted (defends against crafted records).

Fields

§offset: usize
§detail: &'static str
§

BadRunlist(&'static str)

A data runlist is malformed (bad field size, truncated, or overflowing).

§

BadIndex(&'static str)

A directory index node or entry is malformed.

§

BadCompression(&'static str)

LZNT1-compressed data is malformed.

§

BadAttributeList(&'static str)

An $ATTRIBUTE_LIST entry is malformed.

§

NotFound(String)

A path component was not found.

§

NotADirectory(String)

A path component that should be a directory is not one.

§

TooLarge

A structure declared a size that would require an unreasonable allocation — refused rather than attempted (defends against crafted sizes / allocation bombs).

Fields

§bytes: u64
§

Io(Error)

An underlying I/O error.

Trait Implementations§

Source§

impl Debug for NtfsError

Source§

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

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

impl Display for NtfsError

Source§

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

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

impl Error for NtfsError

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 From<Error> for NtfsError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.

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