Skip to main content

OpenFailure

Struct OpenFailure 

Source
pub struct OpenFailure<R> { /* private fields */ }
Expand description

A failed open with its causal error and optional isolated recovery session.

R owns only explicit cleanup authority. Keep this error or take its recovery session before reporting failure. Dropping the error does not confirm cleanup. There is deliberately no conversion into FsError that discards recovery.

§Examples

use qubit_fs::error::{FsError, FsErrorKind, FsOperation, OpenFailure, OpenFailureStage};

assert!(std::any::type_name::<OpenFailure<()>>().contains("OpenFailure"));
let error = FsError::new(FsErrorKind::NotFound, FsOperation::OpenReader, "missing");
assert_eq!(FsOperation::OpenReader, error.operation());
assert_eq!(OpenFailureStage::Preflight, OpenFailureStage::Preflight);

Implementations§

Source§

impl<R> OpenFailure<R>

Source

pub const fn error(&self) -> &FsError

Returns the original failure; cleanup does not rewrite it.

Source

pub const fn stage(&self) -> OpenFailureStage

Returns the stage where opening stopped.

Source

pub const fn recovery(&self) -> Option<&R>

Returns the retained recovery session, or None before an envelope arrived.

Source

pub fn recovery_mut(&mut self) -> Option<&mut R>

Borrows the retained session for explicit cleanup, when available.

Source

pub fn take_recovery(&mut self) -> Option<R>

Transfers recovery ownership without changing the historical failure.

Source

pub fn into_parts(self) -> (FsError, OpenFailureStage, Option<R>)

Returns all failure facts and transfers any recovery ownership.

§Returns

The original error, opening stage, and optional retained recovery session.

Trait Implementations§

Source§

impl<R> Debug for OpenFailure<R>

Source§

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

Formats failure facts without formatting the session or its claimed identity.

Source§

impl<R> Display for OpenFailure<R>

Source§

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

Formats only the original contextual failure.

Source§

impl<R: 'static> Error for OpenFailure<R>

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Exposes the original error chain without surrendering recovery ownership.

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<R> !RefUnwindSafe for OpenFailure<R>

§

impl<R> !UnwindSafe for OpenFailure<R>

§

impl<R> Freeze for OpenFailure<R>
where Option<R>: Freeze,

§

impl<R> Send for OpenFailure<R>
where Option<R>: Send,

§

impl<R> Sync for OpenFailure<R>
where Option<R>: Sync,

§

impl<R> Unpin for OpenFailure<R>
where Option<R>: Unpin,

§

impl<R> UnsafeUnpin for OpenFailure<R>
where Option<R>: UnsafeUnpin,

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

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.