Skip to main content

AtomwriteError

Enum AtomwriteError 

Source
#[non_exhaustive]
pub enum AtomwriteError {
Show 20 variants NotFound { path: PathBuf, }, InvalidInput { reason: String, }, PermissionDenied { path: PathBuf, }, DiskFull { path: PathBuf, }, QuotaExceeded { path: PathBuf, }, CrossDevice { path: PathBuf, }, Io { source: Error, }, ConfigInvalid { reason: String, }, StateDrift { path: PathBuf, expected: String, actual: String, }, WorkspaceJail { path: PathBuf, workspace: PathBuf, }, SymlinkBlocked { path: PathBuf, }, FileImmutable { path: PathBuf, }, BinaryFile { path: PathBuf, }, FifoDetected { path: PathBuf, }, DeviceFile { path: PathBuf, }, ChecksumVerifyFailed { path: PathBuf, expected: String, }, FileTooLarge { path: PathBuf, size: u64, max_size: u64, }, NoMatches, BrokenPipe, InternalError { reason: String, },
}
Expand description

Domain-specific errors for atomic file 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.
§

NotFound

Target file does not exist.

Fields

§path: PathBuf

File path that was not found.

§

InvalidInput

Caller-provided input failed validation.

Fields

§reason: String

Description of the validation failure.

§

PermissionDenied

Insufficient filesystem permissions.

Fields

§path: PathBuf

File path with insufficient permissions.

§

DiskFull

No space left on the device.

Fields

§path: PathBuf

File path where the write failed.

§

QuotaExceeded

Filesystem quota exceeded.

Fields

§path: PathBuf

File path where quota was exceeded.

§

CrossDevice

Rename attempted across different mount points.

Fields

§path: PathBuf

File path involved in cross-device rename.

§

Io

Wrapped standard I/O error.

Fields

§source: Error

Underlying I/O error.

§

ConfigInvalid

Invalid CLI or runtime configuration.

Fields

§reason: String

Description of the configuration problem.

§

StateDrift

File checksum changed between read and write (optimistic lock failure).

Fields

§path: PathBuf

File path with checksum mismatch.

§expected: String

Caller-provided expected checksum.

§actual: String

Actual checksum found on disk.

§

WorkspaceJail

Path resolved outside the workspace jail boundary.

Fields

§path: PathBuf

Path that escaped the workspace jail.

§workspace: PathBuf

Workspace root used for comparison.

§

SymlinkBlocked

Symbolic link encountered when symlinks are disallowed.

Fields

§path: PathBuf

Symlink path that was blocked.

§

FileImmutable

File has immutable attributes preventing modification.

Fields

§path: PathBuf

Immutable file path.

§

BinaryFile

File detected as binary when text-only mode is required.

Fields

§path: PathBuf

Binary file path.

§

FifoDetected

FIFO or named pipe detected where regular file expected.

Fields

§path: PathBuf

FIFO path.

§

DeviceFile

Block or character device file detected.

Fields

§path: PathBuf

Device file path.

§

ChecksumVerifyFailed

Checksum verification failed (hash –verify mismatch).

Fields

§path: PathBuf

File path with checksum mismatch.

§expected: String

Caller-provided expected checksum.

§

FileTooLarge

File exceeds the configured maximum size.

Fields

§path: PathBuf

Path to the oversized file.

§size: u64

Actual file size in bytes.

§max_size: u64

Configured maximum size in bytes.

§

NoMatches

Search or replace found zero matches.

§

BrokenPipe

Downstream consumer closed the output pipe.

§

InternalError

Unexpected internal error.

Fields

§reason: String

Description of the internal failure.

Implementations§

Source§

impl AtomwriteError

Source

pub const fn exit_code(&self) -> u8

Return the process exit code for this error variant.

Source

pub const fn error_class(&self) -> ErrorClass

Classify the error for retry decisions.

Source

pub fn is_retryable(&self) -> bool

Return true if the error class indicates a retry may succeed.

Retryable variants (transient): Self::DiskFull, Self::QuotaExceeded, Self::Io. Retryable variants (conflict): Self::StateDrift, Self::CrossDevice.

All other variants are non-retryable (precondition or permanent).

Source

pub fn is_permanent(&self) -> bool

Return true if retrying this error will never succeed.

Permanent errors include: Self::NotFound, Self::InvalidInput, Self::PermissionDenied, Self::ConfigInvalid, Self::NoMatches, Self::BrokenPipe, and Self::InternalError.

Source

pub const fn error_code(&self) -> &'static str

Return the machine-readable error code string for NDJSON output.

Source

pub fn path(&self) -> Option<&PathBuf>

Return the filesystem path associated with this error, if any.

Trait Implementations§

Source§

impl Debug for AtomwriteError

Source§

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

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

impl Display for AtomwriteError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

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

impl Error for AtomwriteError

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 AtomwriteError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more