Struct Error
pub struct Error { pub(in ::io::error) repr: Repr }
The error type for I/O operations of the Read, Write, Seek, and
associated traits.
Errors mostly originate from the underlying OS, but custom instances of
Error can be created with crafted error messages and a particular value of
ErrorKind.
Fields
repr: Repr
Implementations
impl Error
const INVALID_UTF8: Self = _;const READ_EXACT_EOF: Self = _;const UNKNOWN_THREAD_COUNT: Self = _;const UNSUPPORTED_PLATFORM: Self = _;const WRITE_ALL_EOF: Self = _;const ZERO_TIMEOUT: Self = _;const NO_ADDRESSES: Self = _;
impl Error
unsafe fn from_custom_owner(custom: CustomOwner) -> ErrorSafety
The provided
CustomOwnermust have been constructed from aBoxfrom thealloccrate.fn into_custom_owner(self) -> Result<CustomOwner, Self>const fn from_static_message(msg: &'static SimpleMessage) -> ErrorCreates a new I/O error from a known kind of error as well as a constant message.
This function does not allocate.
You should not use this directly, and instead use the
const_error!macro:io::const_error!(ErrorKind::Something, "some_message").This function should maybe change to
from_static_message<const MSG: &'static str>(kind: ErrorKind)in the future, when const generics allow that.unsafe fn from_raw_os_error_with_functions(code: RawOsError, functions: &'static OsFunctions) -> ErrorSafety
functionsmust point to data that is entirely constant; it must not be created during runtime.fn raw_os_error(&self) -> Option<RawOsError>Returns the OS error that this error represents (if any).
If this
Errorwas constructed vialast_os_errororfrom_raw_os_error, then this function will returnSome, otherwise it will returnNone.Examples
use ;fn get_ref(&self) -> Option<&dyn Error + Send + Sync + 'static>Returns a reference to the inner error wrapped by this error (if any).
If this
Errorwas constructed vianewthen this function will returnSome, otherwise it will returnNone.Examples
use ;fn get_mut(&mut self) -> Option<&mut dyn Error + Send + Sync + 'static>Returns a mutable reference to the inner error wrapped by this error (if any).
If this
Errorwas constructed vianewthen this function will returnSome, otherwise it will returnNone.Examples
use ; use ; use Display;fn kind(&self) -> ErrorKindReturns the corresponding
ErrorKindfor this error.This may be a value set by Rust code constructing custom
io::Errors, or if thisio::Errorwas sourced from the operating system, it will be a value inferred from the system's error encoding. Seelast_os_errorfor more details.Examples
use ;fn is_interrupted(&self) -> bool
Trait Implementations
impl Debug for Error
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for Error
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result
impl Error for Error
fn cause(&self) -> Option<&dyn Error>fn source(&self) -> Option<&dyn Error + 'static>
impl From<ErrorKind> for Error
Auto Trait Implementations
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
Blanket Implementations
impl<T> Any for Error
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Error
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Error
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Error
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Error
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Error
impl<T, U> Into<U> for Error
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Error
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Error
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>