Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 14 variants Io(Error), Corruption { message: String, }, InvalidFormat { message: String, }, UnsupportedFormat { message: String, }, CodecUnavailable { codec: String, }, Conflict { message: String, }, ReadOnly, Closed, RuntimeBusy { message: String, }, BucketMissing { name: String, }, InvalidOptions { message: String, }, Unsupported { feature: &'static str, }, UnsupportedBackend { feature: &'static str, }, UnsupportedDurability { requested: DurabilityMode, },
}
Expand description

Error returned by database, storage, recovery, and transaction operations.

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

Io(Error)

Underlying I/O error from the selected storage backend.

§

Corruption

Durable data failed an integrity or consistency check.

Fields

§message: String

Human-readable corruption detail.

§

InvalidFormat

Bytes could not be decoded as a valid Trine storage record.

Fields

§message: String

Human-readable decode failure detail.

§

UnsupportedFormat

Bytes use a storage format that this crate version does not support.

Fields

§message: String

Human-readable unsupported-format detail.

§

CodecUnavailable

The requested codec is not available in this build.

Fields

§codec: String

Codec name or identifier that was requested.

§

Conflict

An optimistic transaction conflicted with a committed write.

Fields

§message: String

Human-readable conflict detail.

§

ReadOnly

The database was opened read-only and a write was requested.

§

Closed

The database handle is closed.

§

RuntimeBusy

The configured runtime cannot accept the requested work now.

Fields

§message: String

Human-readable runtime capacity detail.

§

BucketMissing

A named bucket required by durable metadata was not found.

Fields

§name: String

Missing bucket name.

§

InvalidOptions

Options were invalid or inconsistent.

Fields

§message: String

Human-readable options failure detail.

§

Unsupported

A Trine feature is unavailable in the current runtime or build.

Fields

§feature: &'static str

Feature name that is unavailable.

§

UnsupportedBackend

The selected storage backend does not provide a required capability.

Fields

§feature: &'static str

Backend capability that is unavailable.

§

UnsupportedDurability

The selected storage backend cannot provide the requested durability.

Fields

§requested: DurabilityMode

Durability mode requested by the caller.

Implementations§

Source§

impl Error

Source

pub const fn unsupported(feature: &'static str) -> Self

Creates an unsupported-feature error.

Source

pub const fn unsupported_backend(feature: &'static str) -> Self

Creates an unsupported-backend error.

Source

pub const fn unsupported_durability(requested: DurabilityMode) -> Self

Creates an unsupported-durability error.

Source

pub fn invalid_options(message: impl Into<String>) -> Self

Creates an invalid-options error.

Examples found in repository?
examples/user_store.rs (line 138)
134fn encode_fields(fields: &[&str]) -> Result<Vec<u8>> {
135    let mut bytes = Vec::new();
136    for field in fields {
137        let len = u32::try_from(field.len())
138            .map_err(|_| Error::invalid_options("user field exceeds u32::MAX"))?;
139        bytes.extend_from_slice(&len.to_le_bytes());
140        bytes.extend_from_slice(field.as_bytes());
141    }
142    Ok(bytes)
143}
More examples
Hide additional examples
examples/event_index.rs (line 139)
135fn encode_fields(fields: &[&str]) -> Result<Vec<u8>> {
136    let mut bytes = Vec::new();
137    for field in fields {
138        let len = u32::try_from(field.len())
139            .map_err(|_| Error::invalid_options("event field exceeds u32::MAX"))?;
140        bytes.extend_from_slice(&len.to_le_bytes());
141        bytes.extend_from_slice(field.as_bytes());
142    }
143    Ok(bytes)
144}
Source

pub fn runtime_busy(message: impl Into<String>) -> Self

Creates a runtime-busy error.

Trait Implementations§

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, formatter: &mut Formatter<'_>) -> Result

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

impl Error for Error

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 Error

Source§

fn from(error: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin 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> 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.