#[repr(transparent)]
pub struct Errno(_);
Available on (Linux or Android) and (x86 or x86-64 or ARM or AArch64), or (target_arch="hexagon" or s390x or M68k or RISC-V RV32 or RISC-V RV64 or LoongArch LA64) and Linux, or crate feature aarch64, or crate feature arc, or crate feature arm, or crate feature arm64, or crate feature csky, or crate feature generic, or crate feature hexagon, or crate feature ia64, or crate feature loongarch, or crate feature loongarch64, or crate feature m68k, or crate feature microblaze, or crate feature nios2, or crate feature openrisc, or crate feature riscv, or crate feature riscv32, or crate feature riscv64, or crate feature s390, or crate feature s390x, or crate feature sh, or crate feature um, or crate feature x86, or crate feature x86_64, or crate feature xtensa only.
Expand description

Error number representation.

Implementations§

source§

impl Errno

source

pub fn new(num: i32) -> Self

Returns a new Errno from the given integer.

source

pub fn into_raw(self) -> i32

Converts Errno into the under underlining integer.

source

pub fn is_valid(&self) -> bool

Returns true if the error code is in valid range (lower than 4096)

source

pub fn from_ret(value: usize) -> Result<usize, Errno>

Returns a new Errno from a syscall’s result.

source

pub fn name(&self) -> Option<&'static str>

Returns the name of the error if it’s known. Generally the name of the constant.

source

pub fn description(&self) -> Option<&'static str>

Returns a description of the error if it’s known.

source

pub fn from_io_error(err: Error) -> Option<Self>

Available on crate feature std only.

Returns a new Errno if the given error is generated from a system error. None otherwise.

source

pub fn iter() -> ErrnoIter

Available on crate feature iter only.

Returns an iterator ErrnoIter over all the known error numbers.

source§

impl Errno

source

pub const EPERM: Self = _

Operation not permitted

source

pub const ENOENT: Self = _

No such file or directory

source

pub const ESRCH: Self = _

No such process

source

pub const EINTR: Self = _

Interrupted system call

source

pub const EIO: Self = _

I/O error

source

pub const ENXIO: Self = _

No such device or address

source

pub const E2BIG: Self = _

Argument list too long

source

pub const ENOEXEC: Self = _

Exec format error

source

pub const EBADF: Self = _

Bad file number

source

pub const ECHILD: Self = _

No child processes

source

pub const EAGAIN: Self = _

Try again

source

pub const ENOMEM: Self = _

Out of memory

source

pub const EACCES: Self = _

Permission denied

source

pub const EFAULT: Self = _

Bad address

source

pub const ENOTBLK: Self = _

Block device required

source

pub const EBUSY: Self = _

Device or resource busy

source

pub const EEXIST: Self = _

File exists

source

pub const EXDEV: Self = _

Cross-device link

source

pub const ENODEV: Self = _

No such device

source

pub const ENOTDIR: Self = _

Not a directory

source

pub const EISDIR: Self = _

Is a directory

source

pub const EINVAL: Self = _

Invalid argument

source

pub const ENFILE: Self = _

File table overflow

source

pub const EMFILE: Self = _

Too many open files

source

pub const ENOTTY: Self = _

Not a typewriter

source

pub const ETXTBSY: Self = _

Text file busy

source

pub const EFBIG: Self = _

File too large

source

pub const ENOSPC: Self = _

No space left on device

source

pub const ESPIPE: Self = _

Illegal seek

source

pub const EROFS: Self = _

Read-only file system

Too many links

source

pub const EPIPE: Self = _

Broken pipe

source

pub const EDOM: Self = _

Math argument out of domain of func

source

pub const ERANGE: Self = _

Math result not representable

source

pub const EDEADLK: Self = _

Resource deadlock would occur

source

pub const ENAMETOOLONG: Self = _

File name too long

source

pub const ENOLCK: Self = _

No record locks available

source

pub const ENOSYS: Self = _

Invalid system call number

source

pub const ENOTEMPTY: Self = _

Directory not empty

source

pub const ELOOP: Self = _

Too many symbolic links encountered

source

pub const ENOMSG: Self = _

No message of desired type

source

pub const EIDRM: Self = _

Identifier removed

source

pub const ECHRNG: Self = _

Channel number out of range

source

pub const EL2NSYNC: Self = _

Level 2 not synchronized

source

pub const EL3HLT: Self = _

Level 3 halted

source

pub const EL3RST: Self = _

Level 3 reset

source

pub const ELNRNG: Self = _

Link number out of range

source

pub const EUNATCH: Self = _

Protocol driver not attached

source

pub const ENOCSI: Self = _

No CSI structure available

source

pub const EL2HLT: Self = _

Level 2 halted

source

pub const EBADE: Self = _

Invalid exchange

source

pub const EBADR: Self = _

Invalid request descriptor

source

pub const EXFULL: Self = _

Exchange full

source

pub const ENOANO: Self = _

No anode

source

pub const EBADRQC: Self = _

Invalid request code

source

pub const EBADSLT: Self = _

Invalid slot

source

pub const EBFONT: Self = _

Bad font file format

source

pub const ENOSTR: Self = _

Device not a stream

source

pub const ENODATA: Self = _

No data available

source

pub const ETIME: Self = _

Timer expired

source

pub const ENOSR: Self = _

Out of streams resources

source

pub const ENONET: Self = _

Machine is not on the network

source

pub const ENOPKG: Self = _

Package not installed

source

pub const EREMOTE: Self = _

Object is remote

Link has been severed

source

pub const EADV: Self = _

Advertise error

source

pub const ESRMNT: Self = _

Srmount error

source

pub const ECOMM: Self = _

Communication error on send

source

pub const EPROTO: Self = _

Protocol error

source

pub const EMULTIHOP: Self = _

Multihop attempted

source

pub const EDOTDOT: Self = _

RFS specific error

source

pub const EBADMSG: Self = _

Not a data message

source

pub const EOVERFLOW: Self = _

Value too large for defined data type

source

pub const ENOTUNIQ: Self = _

Name not unique on network

source

pub const EBADFD: Self = _

File descriptor in bad state

source

pub const EREMCHG: Self = _

Remote address changed

source

pub const ELIBACC: Self = _

Can not access a needed shared library

source

pub const ELIBBAD: Self = _

Accessing a corrupted shared library

source

pub const ELIBSCN: Self = _

.lib section in a.out corrupted

source

pub const ELIBMAX: Self = _

Attempting to link in too many shared libraries

source

pub const ELIBEXEC: Self = _

Cannot exec a shared library directly

source

pub const EILSEQ: Self = _

Illegal byte sequence

source

pub const ERESTART: Self = _

Interrupted system call should be restarted

source

pub const ESTRPIPE: Self = _

Streams pipe error

source

pub const EUSERS: Self = _

Too many users

source

pub const ENOTSOCK: Self = _

Socket operation on non-socket

source

pub const EDESTADDRREQ: Self = _

Destination address required

source

pub const EMSGSIZE: Self = _

Message too long

source

pub const EPROTOTYPE: Self = _

Protocol wrong type for socket

source

pub const ENOPROTOOPT: Self = _

Protocol not available

source

pub const EPROTONOSUPPORT: Self = _

Protocol not supported

source

pub const ESOCKTNOSUPPORT: Self = _

Socket type not supported

source

pub const EOPNOTSUPP: Self = _

Operation not supported on transport endpoint

source

pub const EPFNOSUPPORT: Self = _

Protocol family not supported

source

pub const EAFNOSUPPORT: Self = _

Address family not supported by protocol

source

pub const EADDRINUSE: Self = _

Address already in use

source

pub const EADDRNOTAVAIL: Self = _

Cannot assign requested address

source

pub const ENETDOWN: Self = _

Network is down

source

pub const ENETUNREACH: Self = _

Network is unreachable

source

pub const ENETRESET: Self = _

Network dropped connection because of reset

source

pub const ECONNABORTED: Self = _

Software caused connection abort

source

pub const ECONNRESET: Self = _

Connection reset by peer

source

pub const ENOBUFS: Self = _

No buffer space available

source

pub const EISCONN: Self = _

Transport endpoint is already connected

source

pub const ENOTCONN: Self = _

Transport endpoint is not connected

source

pub const ESHUTDOWN: Self = _

Cannot send after transport endpoint shutdown

source

pub const ETOOMANYREFS: Self = _

Too many references: cannot splice

source

pub const ETIMEDOUT: Self = _

Connection timed out

source

pub const ECONNREFUSED: Self = _

Connection refused

source

pub const EHOSTDOWN: Self = _

Host is down

source

pub const EHOSTUNREACH: Self = _

No route to host

source

pub const EALREADY: Self = _

Operation already in progress

source

pub const EINPROGRESS: Self = _

Operation now in progress

source

pub const ESTALE: Self = _

Stale file handle

source

pub const EUCLEAN: Self = _

Structure needs cleaning

source

pub const ENOTNAM: Self = _

Not a XENIX named type file

source

pub const ENAVAIL: Self = _

No XENIX semaphores available

source

pub const EISNAM: Self = _

Is a named type file

source

pub const EREMOTEIO: Self = _

Remote I/O error

source

pub const EDQUOT: Self = _

Quota exceeded

source

pub const ENOMEDIUM: Self = _

No medium found

source

pub const EMEDIUMTYPE: Self = _

Wrong medium type

source

pub const ECANCELED: Self = _

Operation Canceled

source

pub const ENOKEY: Self = _

Required key not available

source

pub const EKEYEXPIRED: Self = _

Key has expired

source

pub const EKEYREVOKED: Self = _

Key has been revoked

source

pub const EKEYREJECTED: Self = _

Key was rejected by service

source

pub const EOWNERDEAD: Self = _

Owner died

source

pub const ENOTRECOVERABLE: Self = _

State not recoverable

source

pub const ERFKILL: Self = _

Operation not possible due to RF-kill

source

pub const EHWPOISON: Self = _

Memory page has hardware error

source

pub const ERESTARTSYS: Self = _

Restart syscall

source

pub const ERESTARTNOINTR: Self = _

Restart if no interrupt

source

pub const ERESTARTNOHAND: Self = _

restart if no handler..

source

pub const ENOIOCTLCMD: Self = _

No ioctl command

source

pub const ERESTART_RESTARTBLOCK: Self = _

restart by calling sys_restart_syscall

source

pub const EPROBE_DEFER: Self = _

Driver requests probe retry

source

pub const EOPENSTALE: Self = _

open found a stale dentry

source

pub const ENOPARAM: Self = _

Parameter not supported

source

pub const EBADHANDLE: Self = _

Illegal NFS file handle

source

pub const ENOTSYNC: Self = _

Update synchronization mismatch

source

pub const EBADCOOKIE: Self = _

Cookie is stale

source

pub const ENOTSUPP: Self = _

Operation is not supported

source

pub const ETOOSMALL: Self = _

Buffer or request is too small

source

pub const ESERVERFAULT: Self = _

An untranslatable error occurred

source

pub const EBADTYPE: Self = _

Type not supported by server

source

pub const EJUKEBOX: Self = _

Request initiated, but will not complete before timeout

source

pub const EIOCBQUEUED: Self = _

iocb queued, will get completion event

source

pub const ERECALLCONFLICT: Self = _

conflict with recalled state

source

pub const ENOGRACE: Self = _

NFS file lock reclaim refused

source

pub const EDEADLOCK: Self = Self::EDEADLK

Alias for Self::EDEADLK

source

pub const EWOULDBLOCK: Self = Self::EAGAIN

Alias for Self::EAGAIN

source

pub const MIN: i32 = 1i32

source

pub const MAX: i32 = 531i32

source§

impl Errno

source

pub fn last_os_error() -> Self

Available on (Linux or Android) and (x86 or x86-64 or ARM or AArch64), or (target_arch="hexagon" or s390x or PowerPC or PowerPC-64 or MIPS or MIPS-64 or M68k or RISC-V RV32 or RISC-V RV64 or target_arch="sparc" or SPARC64 or LoongArch LA64) and Linux only.

Returns a new Errno from last OS error.

Trait Implementations§

source§

impl Clone for Errno

source§

fn clone(&self) -> Errno

Returns a copy of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Errno

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Errno

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Error for Errno

Available on crate feature std only.
1.30.0§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl Error for Errno

Available on crate feature no_std_io-compat only.
source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
source§

impl From<Errno> for Error

Available on crate feature std only.
source§

fn from(value: Errno) -> Self

Converts to this type from the input type.
source§

impl From<Errno> for Error

Available on crate feature no_std_io-compat only.
source§

fn from(value: Errno) -> Self

Converts to this type from the input type.
source§

impl Hash for Errno

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given [Hasher]. Read more
1.3.0§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given [Hasher]. Read more
source§

impl Ord for Errno

source§

fn cmp(&self, other: &Errno) -> Ordering

This method returns an [Ordering] between self and other. Read more
1.21.0§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<Errno> for Errno

source§

fn eq(&self, other: &Errno) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Errno> for Errno

source§

fn partial_cmp(&self, other: &Errno) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for Errno

source§

impl Eq for Errno

source§

impl StructuralEq for Errno

source§

impl StructuralPartialEq for Errno

Auto Trait Implementations§

§

impl RefUnwindSafe for Errno

§

impl Send for Errno

§

impl Sync for Errno

§

impl Unpin for Errno

§

impl UnwindSafe for Errno

Blanket Implementations§

§

impl<T> Any for Twhere T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for Twhere T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for Twhere U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<E> Provider for Ewhere E: Error + ?Sized,

§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> ToString for Twhere T: Display + ?Sized,

§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.