pub struct Error(/* private fields */);Expand description
Generic integer kernel error.
The kernel defines a set of integer generic error codes based on C and POSIX ones. These codes may have a more specific meaning in some contexts.
§Invariants
The value is a valid errno (i.e. >= -MAX_ERRNO && < 0).
Implementations§
Source§impl Error
impl Error
Sourcepub fn from_errno(errno: c_int) -> Error
pub fn from_errno(errno: c_int) -> Error
Creates an Error from a kernel error code.
errno must be within error code range (i.e. >= -MAX_ERRNO && < 0).
It is a bug to pass an out-of-range errno. code::EINVAL is returned in such a case.
§Examples
assert_eq!(Error::from_errno(-1), EPERM);
assert_eq!(Error::from_errno(-2), ENOENT);The following calls are considered a bug:
assert_eq!(Error::from_errno(0), EINVAL);
assert_eq!(Error::from_errno(-1000000), EINVAL);Trait Implementations§
Source§impl<T> From<AllocError<T>> for Error
impl<T> From<AllocError<T>> for Error
Source§fn from(insert_err: AllocError<T>) -> Error
fn from(insert_err: AllocError<T>) -> Error
Converts to this type from the input type.
Source§impl From<AllocError> for Error
impl From<AllocError> for Error
Source§fn from(_: AllocError) -> Error
fn from(_: AllocError) -> Error
Converts to this type from the input type.
Source§impl From<AllocErrorKind> for Error
impl From<AllocErrorKind> for Error
Source§fn from(kind: AllocErrorKind) -> Error
fn from(kind: AllocErrorKind) -> Error
Converts to this type from the input type.
Source§impl From<BadFdError> for Error
impl From<BadFdError> for Error
Source§fn from(_: BadFdError) -> Error
fn from(_: BadFdError) -> Error
Converts to this type from the input type.
Source§impl From<FromBytesWithNulError> for Error
impl From<FromBytesWithNulError> for Error
Source§fn from(_: FromBytesWithNulError) -> Error
fn from(_: FromBytesWithNulError) -> Error
Converts to this type from the input type.
Source§impl From<Infallible> for Error
impl From<Infallible> for Error
Source§fn from(e: Infallible) -> Error
fn from(e: Infallible) -> Error
Converts to this type from the input type.
Source§impl<T> From<InsertError<T>> for Error
impl<T> From<InsertError<T>> for Error
Source§fn from(_: InsertError<T>) -> Error
fn from(_: InsertError<T>) -> Error
Converts to this type from the input type.
Source§impl<T> From<InsertError<T>> for Error
impl<T> From<InsertError<T>> for Error
Source§fn from(insert_err: InsertError<T>) -> Error
fn from(insert_err: InsertError<T>) -> Error
Converts to this type from the input type.