Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 13 variants Refused { backend: &'static str, missing: Vec<Missing>, }, NotDeclared(Need), NotFound(String), AlreadyExists(String), Backend(String), Corrupt(String), KindMismatch { expected: &'static str, found: String, }, SchemaUnsupported { kind: &'static str, found: u32, expected: u32, }, UpgradeFailed { kind: &'static str, from: u32, expected: u32, detail: String, }, Encode(String), Injected(String), Panicked(String), Reentrant,
}
Expand description

Everything that can go wrong in PersistAnt.

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

Refused

The backend cannot give every declared need. Raised at open, before any data is touched.

Fields

§backend: &'static str

The backend that was refused, as a short name ("fs", "memory").

§missing: Vec<Missing>

Every unmet need, not just the first.

§

NotDeclared(Need)

An operation was used whose need was never declared at open.

§

NotFound(String)

read or stat found no value at this key (the key is given). A disk or network failure is Error::Backend instead.

§

AlreadyExists(String)

create_if_absent found a value already at this key (the key is given); nothing was written.

§

Backend(String)

The backend failed; the text is the backend’s own message.

§

Corrupt(String)

Stored bytes are not a record envelope (not JSON, or fields missing).

§

KindMismatch

The stored record is of another kind than the one asked for.

Fields

§expected: &'static str

Kind the program asked for.

§found: String

Kind found in storage.

§

SchemaUnsupported

The stored schema version is one the program cannot read: newer than it knows, or older with no upgrade path.

Fields

§kind: &'static str

The record kind.

§found: u32

Schema version found in storage.

§expected: u32

Schema version the program writes.

§

UpgradeFailed

An older record was upgraded, but the result does not fit the current type. Either the stored data was damaged, or crate::Record::upgrade did not bring it all the way to SCHEMA (upgraded data carries no schema marker, so the two cannot be told apart).

Fields

§kind: &'static str

The record kind.

§from: u32

Schema version found in storage.

§expected: u32

Schema version the upgrade had to reach.

§detail: String

What the current type rejected.

§

Encode(String)

A record could not be turned into bytes.

§

Injected(String)

A failure produced on purpose by the fault-injecting fake.

§

Panicked(String)

An operation panicked on the blocking facade’s worker thread. The text is the panic message when it was a string, otherwise a placeholder. The store stays usable.

§

Reentrant

A blocking::Store call was made from a thread that is a blocking facade’s own worker. Waiting there for a reply would park the worker on itself, so the call is refused instead of deadlocking; use the async crate::Store in code that runs on a worker.

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

Formats the value using the given formatter. Read more
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

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> 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> MaybeSend for T
where T: Send,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.