Struct Errno

Source
pub struct Errno(/* private fields */);
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 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.

Examples found in repository?
examples/list.rs (line 9)
5pub fn main() {
6    for errno in Errno::iter() {
7        println!(
8            "{}: {}",
9            errno.name().unwrap(),
10            errno.description().unwrap()
11        );
12    }
13}
Source

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

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

Examples found in repository?
examples/list.rs (line 10)
5pub fn main() {
6    for errno in Errno::iter() {
7        println!(
8            "{}: {}",
9            errno.name().unwrap(),
10            errno.description().unwrap()
11        );
12    }
13}
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.

Examples found in repository?
examples/list.rs (line 6)
5pub fn main() {
6    for errno in Errno::iter() {
7        println!(
8            "{}: {}",
9            errno.name().unwrap(),
10            errno.description().unwrap()
11        );
12    }
13}
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) and crate feature libc-compat 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)>

Returns 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, request: &mut Request<'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) -> Self
where Self: Sized,

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

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

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

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

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

impl PartialEq for Errno

Source§

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

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

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd 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

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

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

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

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

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

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 StructuralPartialEq for Errno

Auto Trait Implementations§

§

impl Freeze for Errno

§

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 T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where 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<T> ToOwned for T
where 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 T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.