pub struct AsyncWriteAllOperationFailure { /* private fields */ }Expand description
Error returned by an owning asynchronous whole-file write.
Recovery ownership remains in the operation even when this error is consumed.
§Examples
use qubit_fs::Path;
use qubit_fs::write::WriteOptions;
use qubit_fs::write::AsyncWriterRecovery;
use qubit_fs::write::WriteFailureState;
let mut operation = filesystem.begin_write_all(
Path::parse("/report")?, b"bytes".to_vec(), WriteOptions::default(),
)?;
let failure = operation.execute().await.expect_err("fixture commit failure");
assert_eq!(WriteFailureState::NotPublished, failure.state());
assert_eq!(5, failure.written_bytes());
assert!(operation.has_recovery());
let cleanup = match operation.recovery().expect("retained session") {
AsyncWriterRecovery::Opened(writer) => writer.abort_async().await,
AsyncWriterRecovery::Rejected(writer) => writer.abort_async().await,
};
assert!(cleanup.is_ok());
// Application error handling can retain `failure`, `cleanup`, and `operation`.Implementations§
Source§impl AsyncWriteAllOperationFailure
impl AsyncWriteAllOperationFailure
Sourcepub const fn state(&self) -> WriteFailureState
pub const fn state(&self) -> WriteFailureState
Returns the publication facts recorded when execution stopped.
Sourcepub const fn written_bytes(&self) -> u64
pub const fn written_bytes(&self) -> u64
Returns bytes acknowledged by completed writes before execution stopped.
Sourcepub fn into_error(self) -> FsError
pub fn into_error(self) -> FsError
Consumes the failure and returns its filesystem error.
This discards publication state and confirmed byte count. The operation
still owns any recovery writer; prefer into_parts when recovering.
Sourcepub fn into_parts(self) -> (FsError, WriteFailureState, u64)
pub fn into_parts(self) -> (FsError, WriteFailureState, u64)
Consumes the failure and returns all recovery facts.
Trait Implementations§
Source§impl Error for AsyncWriteAllOperationFailure
impl Error for AsyncWriteAllOperationFailure
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 !RefUnwindSafe for AsyncWriteAllOperationFailure
impl !UnwindSafe for AsyncWriteAllOperationFailure
impl Freeze for AsyncWriteAllOperationFailure
impl Send for AsyncWriteAllOperationFailure
impl Sync for AsyncWriteAllOperationFailure
impl Unpin for AsyncWriteAllOperationFailure
impl UnsafeUnpin for AsyncWriteAllOperationFailure
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