pub struct Error(/* private fields */);Expand description
Type for error numbers returned from Linux system calls.
The Error type implements PartialEq for many integer types, and
(optionally) with the POSIX error numbers defined in the posix-errno
library.
Implementations§
Source§impl Error
 
impl Error
Sourcepub const fn new(errno: u16) -> Option<Error>
 
pub const fn new(errno: u16) -> Option<Error>
Create a new error from a raw error number. If outside the permitted
range [1, 4096) for Linux error numbers, returns None.
Sourcepub const unsafe fn new_unchecked(errno: u16) -> Error
 
pub const unsafe fn new_unchecked(errno: u16) -> Error
Unsafely create a new error from a raw error number, without checking whether it’s within the permitted range for Linux error numbers.
§Safety
The caller must ensure that 0 < errno <= 0xFFF. In particular, it is
undefined behavior if errno is zero.
Sourcepub const fn get_nonzero(&self) -> NonZeroU16
 
pub const fn get_nonzero(&self) -> NonZeroU16
Returns the error number as a NonZeroU16.
Trait Implementations§
Source§impl From<Error> for NonZeroI32
 
impl From<Error> for NonZeroI32
Source§fn from(err: Error) -> NonZeroI32
 
fn from(err: Error) -> NonZeroI32
Converts to this type from the input type.
Source§impl From<Error> for NonZeroI64
 
impl From<Error> for NonZeroI64
Source§fn from(err: Error) -> NonZeroI64
 
fn from(err: Error) -> NonZeroI64
Converts to this type from the input type.
Source§impl From<Error> for NonZeroU16
 
impl From<Error> for NonZeroU16
Source§fn from(err: Error) -> NonZeroU16
 
fn from(err: Error) -> NonZeroU16
Converts to this type from the input type.
Source§impl From<Error> for NonZeroU32
 
impl From<Error> for NonZeroU32
Source§fn from(err: Error) -> NonZeroU32
 
fn from(err: Error) -> NonZeroU32
Converts to this type from the input type.
Source§impl From<Error> for NonZeroU64
 
impl From<Error> for NonZeroU64
Source§fn from(err: Error) -> NonZeroU64
 
fn from(err: Error) -> NonZeroU64
Converts to this type from the input type.
Source§impl Ord for Error
 
impl Ord for Error
Source§impl PartialEq<Error> for NonZeroI16
 
impl PartialEq<Error> for NonZeroI16
Source§impl PartialEq<Error> for NonZeroI32
 
impl PartialEq<Error> for NonZeroI32
Source§impl PartialEq<Error> for NonZeroI64
 
impl PartialEq<Error> for NonZeroI64
Source§impl PartialEq<Error> for NonZeroIsize
 
impl PartialEq<Error> for NonZeroIsize
Source§impl PartialEq<Error> for NonZeroU16
 
impl PartialEq<Error> for NonZeroU16
Source§impl PartialEq<Error> for NonZeroU32
 
impl PartialEq<Error> for NonZeroU32
Source§impl PartialEq<Error> for NonZeroU64
 
impl PartialEq<Error> for NonZeroU64
Source§impl PartialEq<Error> for NonZeroUsize
 
impl PartialEq<Error> for NonZeroUsize
Source§impl PartialOrd for Error
 
impl PartialOrd for Error
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