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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)