Skip to main content

NsfError

Enum NsfError 

Source
pub enum NsfError {
    TooShort {
        actual: usize,
        required: usize,
    },
    BadFileSignature {
        observed: [u8; 2],
    },
    BadHeaderSize {
        size: u32,
    },
    BadSubrecordSignature {
        kind: &'static str,
        expected: [u8; 2],
        observed: [u8; 2],
    },
    CompressionUnsupported {
        structure: &'static str,
        compression_type: u16,
    },
    BucketIndexOutOfRange {
        requested: u32,
        available: usize,
    },
    SlotIndexOutOfRange {
        requested: u16,
        available: u32,
    },
    DecompressionFailed {
        detail: &'static str,
    },
}
Expand description

Top-level parser error.

Variants§

§

TooShort

File is shorter than the minimum size required to even hold a valid NSF file header (6 bytes).

Fields

§actual: usize

Bytes actually available.

§required: usize

Bytes required for the operation that failed.

§

BadFileSignature

The 2-byte file-header signature did not match the NSF LSIG marker (0x1A 0x00). Likely not an NSF file at all.

Fields

§observed: [u8; 2]

The two bytes that were read at file offset 0.

§

BadHeaderSize

The database-header-size field in the file header is implausible (zero, larger than any documented NSF, or larger than the file itself).

Fields

§size: u32

The size value read from the file header.

§

BadSubrecordSignature

A subrecord (superblock, bucket descriptor block, …) signature check failed. Distinct from Self::BadFileSignature so the error message can identify which structure failed validation.

Fields

§kind: &'static str

Short human-readable name of the structure whose signature failed (e.g. “superblock”, “BDB header”).

§expected: [u8; 2]

Expected signature bytes (typically 2 bytes).

§observed: [u8; 2]

Observed bytes at the signature position.

§

CompressionUnsupported

A structure required for the requested operation is stored compressed and the parser does not yet implement the compression scheme. The canonical case: on modern ODS the superblock body (which carries the bucket-descriptor array that maps a bucket_index to a file offset) is stored with Domino “CX” compression. Resolving an crate::RrvLocation::BucketSlot entry to bytes requires decompressing that body first. Until the CX decompressor lands, bucket-slot resolution returns this error rather than guessing - in a forensic context a wrong decompressor silently corrupts evidence, which is worse than an explicit not-yet-supported signal.

Fields

§structure: &'static str

Structure whose body is compressed (e.g. “superblock body”).

§compression_type: u16

The compression-type value read from the structure header.

§

BucketIndexOutOfRange

A bucket_index from an RRV entry is past the end of the parsed bucket-descriptor array. Indicates either corruption or a stale (non-freshest) superblock being consulted.

Fields

§requested: u32

The bucket index requested.

§available: usize

The number of bucket descriptors actually present.

§

SlotIndexOutOfRange

A slot_index from an RRV entry is outside the bucket’s slot table. Slot indices are 1-based on disk; zero is never valid.

Fields

§requested: u16

The slot index requested (1-based as stored on disk).

§available: u32

The number of slots the bucket actually declares.

§

DecompressionFailed

Decompression of a compressed structure failed: the compressed stream was truncated, a back-reference pointed before the start of the output, or the declared output size was exceeded. Distinct from Self::CompressionUnsupported (which means “scheme not implemented”); this means “scheme implemented, but this input did not decode cleanly”.

Fields

§detail: &'static str

Short description of which invariant the stream violated.

Trait Implementations§

Source§

impl Clone for NsfError

Source§

fn clone(&self) -> NsfError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NsfError

Source§

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

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

impl Display for NsfError

Source§

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

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

impl Eq for NsfError

Source§

impl Error for NsfError

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 NsfError

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for NsfError

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.