pub struct Error(/* private fields */);
Expand description
An error returned by a system call.
Implementations§
Source§impl Error
impl Error
Sourcepub const fn from_code(code: u16) -> Self
pub const fn from_code(code: u16) -> Self
Creates a new error from an error code.
§Panics
Panics if the code is not between 1
and MAX_ERRNO
, inclusive.
Sourcepub const fn value(&self) -> i16
pub const fn value(&self) -> i16
Returns the error value.
Unlike the errno
variable in C, this value is negative as it reflects the return value of
a system call. It will always be between -MAX_ERRNO
and -1
, inclusive.
Sourcepub const fn code(&self) -> u16
pub const fn code(&self) -> u16
Returns the error code.
The error code is the opposite of the error value. It will always be between 1
and
MAX_ERRNO
, inclusive.
Sourcepub const fn description(&self) -> Option<&'static str>
pub const fn description(&self) -> Option<&'static str>
Returns a textual description of the error.
Trait Implementations§
impl Copy for Error
impl Eq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin 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
Mutably borrows from an owned value. Read more