Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 23 variants Flash(NorFlashErrorKind), NotMounted, AlreadyMounted, PayloadTooLarge, BufferTooSmall, CorruptEntry, NoSpace, InvalidConfig, TooManySectors, SizeMismatch { expected: usize, actual: usize, }, SchemaMismatch { expected: u8, found: u8, }, InvalidData, InvalidRun, Overflow, NotAttached, AlreadyAttached, VolumeLost, ForeignVolume { expected: u32, found: u32, }, UnsupportedVersion { found: u8, }, GeometryMismatch, CorruptCursor, ReadsUnavailable, RegionOverlap { db_base: u32, db_end: u32, },
}
Expand description

Database error type.

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

Flash(NorFlashErrorKind)

Flash operation failed.

§

NotMounted

Database is not mounted.

§

AlreadyMounted

Database is already mounted.

§

PayloadTooLarge

Payload exceeds maximum size for a single entry.

§

BufferTooSmall

Provided buffer is too small for the entry payload.

§

CorruptEntry

Entry CRC mismatch or invalid marker.

§

NoSpace

No space available in flash (all sectors full or reserved).

§

InvalidConfig

Invalid configuration parameters.

§

TooManySectors

Sector count exceeds MAX_SECTORS const generic.

§

SizeMismatch

Data size does not match expected type size.

Fields

§expected: usize

Size of the type the caller asked for.

§actual: usize

Size of the payload actually stored.

§

SchemaMismatch

The entry was written under a different schema version of its type.

The struct bound to this sensor ID has changed since the entry was stored. See SensorData::SCHEMA_VERSION for how to read both eras out of one log.

Fields

§expected: u8

SCHEMA_VERSION of the type the caller asked for.

§found: u8

Schema version tagged into the stored payload.

§

InvalidData

Failed to interpret bytes as the target type.

§

InvalidRun

A Run’s parameters cannot be encoded as a single entry.

The sample slice was empty or longer than u16::MAX, the sample type is zero-sized, the last sample’s timestamp would overflow u64, or the frame would exceed the u16 payload length an entry header can carry. Whether the run fits a flash page is a separate question, answered by PayloadTooLarge.

§

Overflow

Arithmetic overflow in offset calculation.

§

NotAttached

No removable volume is attached.

§

AlreadyAttached

A volume is already attached; detach it first.

§

VolumeLost

The volume disappeared or faulted mid-operation.

Detach and re-attach to recover. Note that a genuine flash fault on the medium is indistinguishable from removal at the driver level, so this is a policy verdict rather than a hardware report — see Removable for drivers that can tell the difference.

§

ForeignVolume

The volume belongs to a different logical log.

Returned instead of treating the medium as blank, which would erase another device’s data.

Fields

§expected: u32

The log_id this database expects (0 if anonymous).

§found: u32

The log_id found on the medium.

§

UnsupportedVersion

The medium is formatted with a version this build cannot read.

Fields

§found: u8

The format version found on the medium.

§

GeometryMismatch

Source and destination geometries are incompatible for replication.

The destination’s page size must be at least the source’s, or entries near the source’s maximum payload could never be copied.

§

CorruptCursor

The on-medium replication cursor is unreadable or structurally invalid.

§

ReadsUnavailable

This database was mounted without a full index and cannot serve reads.

See MountMode::HeadersOnly.

§

RegionOverlap

The requested flash region intersects the database’s own sectors.

Raised by SensorDb::with_region and its async counterpart, which broker access to other things living on the same chip. Writing inside the database region behind the database’s back corrupts the log, and the damage would not surface until a later mount.

Fields

§db_base: u32

First byte of the database region.

§db_end: u32

Byte after the last byte of the database region.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Self

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 Copy for Error

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Eq for Error

Source§

impl Error for Error

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 Format for Error

Available on crate feature defmt only.
Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl<E: NorFlashError> From<E> for Error

Source§

fn from(e: E) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Error

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 Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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

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.