pub enum DiskError {
InsufficientSpace {
required: u64,
available: Option<u64>,
},
IoError(String),
PermissionDenied(String),
}Expand description
Structured error type for disk-related failures during download.
Provides specific error variants for different disk failure scenarios, enabling callers to handle each case appropriately (e.g., show user-friendly messages, trigger cleanup, or retry with smaller files).
§Examples
ⓘ
use aria2_core::filesystem::disk_space::DiskError;
match check_disk_space(path, required_bytes) {
Ok(()) => println!("Sufficient space"),
Err(DiskError::InsufficientSpace { required, available }) => {
eprintln!("Need {} but only {} available", required, available.unwrap_or(0));
}
Err(DiskError::IoError(msg)) => eprintln!("I/O error: {}", msg),
Err(DiskError::PermissionDenied(p)) => eprintln!("Permission denied: {}", p),
}Variants§
InsufficientSpace
Not enough disk space available
Fields
IoError(String)
General I/O error during disk operation
PermissionDenied(String)
Permission denied when accessing path
Trait Implementations§
Source§impl Error for DiskError
impl Error for DiskError
1.30.0 · 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 Freeze for DiskError
impl RefUnwindSafe for DiskError
impl Send for DiskError
impl Sync for DiskError
impl Unpin for DiskError
impl UnsafeUnpin for DiskError
impl UnwindSafe for DiskError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 more