pub struct Error { /* private fields */ }Expand description
An error returned by a VFS operation.
In addition to a portable ErrorKind, this retains the original message
and, when available, the originating system’s native error number.
Implementations§
Source§impl Error
impl Error
Sourcepub fn new(kind: ErrorKind, message: impl ToString) -> Self
pub fn new(kind: ErrorKind, message: impl ToString) -> Self
Creates an error without a native error number.
Sourcepub fn other(error: impl ToString) -> Self
pub fn other(error: impl ToString) -> Self
Creates an unclassified error from a displayable value.
Sourcepub fn from_system_code(
kind: ErrorKind,
message: impl Into<String>,
operating_system: OperatingSystem,
raw: i32,
) -> Self
pub fn from_system_code( kind: ErrorKind, message: impl Into<String>, operating_system: OperatingSystem, raw: i32, ) -> Self
Creates an error with a native error number and its source platform.
Sourcepub fn from_raw_os_error(raw: i32) -> Self
pub fn from_raw_os_error(raw: i32) -> Self
Converts a native error number from the current host.
Sourcepub fn last_os_error() -> Self
pub fn last_os_error() -> Self
Captures the calling thread’s last operating-system error.
Sourcepub fn from_raw_os_error_with_message(
raw: i32,
message: impl Into<String>,
) -> Self
pub fn from_raw_os_error_with_message( raw: i32, message: impl Into<String>, ) -> Self
Converts a native error number from the current host while preserving a caller-supplied message.
Sourcepub fn from_raw_os_error_with_kind(raw: i32, kind: ErrorKind) -> Self
pub fn from_raw_os_error_with_kind(raw: i32, kind: ErrorKind) -> Self
Converts a native error number from the current host while preserving a caller-supplied kind.
Sourcepub const fn system_code(&self) -> Option<SystemCode>
pub const fn system_code(&self) -> Option<SystemCode>
Returns the tagged native error number, if one was supplied.
Sourcepub const fn raw_os_error(&self) -> Option<i32>
pub const fn raw_os_error(&self) -> Option<i32>
Returns the untagged native error number, if one was supplied.
Sourcepub fn into_io_error(self) -> Error
pub fn into_io_error(self) -> Error
Converts this error into io::Error, preserving its portable kind.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Error
impl<'de> Deserialize<'de> for Error
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl<H> From<HandoffError<H>> for Error
impl<H> From<HandoffError<H>> for Error
Source§fn from(error: HandoffError<H>) -> Self
fn from(error: HandoffError<H>) -> Self
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> ⓘ
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> ⓘ
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