pub enum WriteError<E> {
BeforeCommit(E),
AfterCommit(E),
}Expand description
A failed atomic write, tagged with whether the write had already committed.
The distinction is what a caller holding in-memory state needs: after
WriteError::committed the bytes are installed and readers already see
them, so the caller’s own copy must move forward even though the call
failed. Before commit the target file is untouched and the caller keeps
what it had.
Variants§
BeforeCommit(E)
The target file is untouched; nothing was installed.
AfterCommit(E)
The rename landed and readers see the new bytes; only the durability work that follows it failed.
Implementations§
Source§impl<E> WriteError<E>
impl<E> WriteError<E>
Sourcepub fn committed(&self) -> bool
pub fn committed(&self) -> bool
Whether the new bytes are already installed at the target path.
pub fn into_inner(self) -> E
Sourcepub fn map<F>(self, convert: impl FnOnce(E) -> F) -> WriteError<F>
pub fn map<F>(self, convert: impl FnOnce(E) -> F) -> WriteError<F>
Convert the payload, preserving the commit phase.
Trait Implementations§
Source§impl<E> Debug for WriteError<E>where
E: Debug,
impl<E> Debug for WriteError<E>where
E: Debug,
Source§impl<E> Display for WriteError<E>where
E: Display,
impl<E> Display for WriteError<E>where
E: Display,
Source§impl<E> Error for WriteError<E>where
E: Error + 'static,
impl<E> Error for WriteError<E>where
E: Error + 'static,
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl<E> Freeze for WriteError<E>where
E: Freeze,
impl<E> RefUnwindSafe for WriteError<E>where
E: RefUnwindSafe,
impl<E> Send for WriteError<E>where
E: Send,
impl<E> Sync for WriteError<E>where
E: Sync,
impl<E> Unpin for WriteError<E>where
E: Unpin,
impl<E> UnsafeUnpin for WriteError<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for WriteError<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.