Error in kernel::error - Rust
Skip to main content Error kernel :: error Struct Error Source 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 Source 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); Source pub fn to_errno (self) -> c_int Returns the kernel error code. Source pub fn to_ptr <T>(self) -> *mut T Returns the error encoded as a pointer.
Source pub fn name (&self) -> Option <&'static CStr > Returns a string representing the error, if one exists. Trait Implementations § Source § impl Clone for Error Source § fn clone (&self) -> Self Returns a duplicate of the value. Read more 1.0.0 (const: unstable ) · Source § fn clone_from (&mut self, source: &Self) Performs copy-assignment from source . Read more Source § impl Copy for Error Source § impl Debug for Error Source § fn fmt (&self, f: &mut Formatter <'_>) -> Result Formats the value using the given formatter.
Read more Source § impl Eq for Error Source § impl From < ! > for Error Source § fn from (e: Infallible ) -> Error Converts to this type from the input type. Source § impl<T> From < AllocError <T>> for Error Source § fn from (insert_err: AllocError <T>) -> Error Converts to this type from the input type. Source § impl From < AllocError > for Error Source § fn from (_: AllocError ) -> Error Converts to this type from the input type.
Source § impl From < AllocErrorKind > for Error Source § fn from (kind: AllocErrorKind ) -> Error Converts to this type from the input type. Source § impl From < BadFdError > for Error Source § fn from (_: BadFdError ) -> Error Converts to this type from the input type. Source § impl<T> From < CallbackError <T>> for Error Source § fn from (err: CallbackError <T>) -> Self Converts to this type from the input type.
Source § impl From < Error > for Error Source § fn from (_: Error ) -> Error Converts to this type from the input type. Source § impl From < FromBytesWithNulError > for Error Source § fn from (_: FromBytesWithNulError ) -> Error Converts to this type from the input type. Source § impl<T> From < InsertError <T>> for Error Source § fn from (_: InsertError <T>) -> Error Converts to this type from the input type. Source § impl<T> From < InsertError <T>> for Error Source § fn from (insert_err: InsertError <T>) -> Error Converts to this type from the input type.
Source § impl From < InsertErrorKind > for Error Source § fn from (kind: InsertErrorKind ) -> Error Converts to this type from the input type. Source § impl From < LayoutError > for Error Source § fn from (_: LayoutError ) -> Error Converts to this type from the input type. Source § impl From < OutOfBound > for Error Source § fn from (_: OutOfBound ) -> Self Converts to this type from the input type. Source § impl<T> From < PushError <T>> for Error Source § fn from (_: PushError <T>) -> Error Converts to this type from the input type.
Source § impl From < RemoveError > for Error Source § fn from (_: RemoveError ) -> Error Converts to this type from the input type. Source § impl<T> From < StoreError <T>> for Error Source § fn from (value: StoreError <T>) -> Self Converts to this type from the input type. Source § impl From < TryFromIntError > for Error Source § fn from (_: TryFromIntError ) -> Error Converts to this type from the input type. Source § impl From < Utf8Error > for Error Source § fn from (_: Utf8Error ) -> Error Converts to this type from the input type.
Source § impl PartialEq for Error Source § fn eq (&self, other: &Self) -> bool Equality operator == . Read more 1.0.0 (const: unstable ) · Source § fn ne (&self, other: &Rhs ) -> bool Inequality operator != . Read more Source § impl StructuralPartialEq for Error Source § impl ZeroableOption 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 UnsafeUnpin for Error § impl UnwindSafe for Error Blanket Implementations § Source § impl<T> Any for T where T: 'static + ?
Sized , Source § fn type_id (&self) -> TypeId Gets the TypeId of self . Read more Source § impl<T> Borrow <T> for T where T: ? Sized , Source § fn borrow (&self) -> &T Immutably borrows from an owned value. Read more Source § impl<T> BorrowMut <T> for T where T: ? Sized , Source § fn borrow_mut (&mut self) -> &mut T Mutably borrows from an owned value. Read more Source § impl<ST, DT> CastableFrom <ST, Initialized , Initialized > for DT where ST: ?
Sized , DT: ? Sized , Source § impl<ST, DT> CastableFrom <ST, Uninit , Uninit > for DT where ST: ? Sized , DT: ? Sized , Source § impl<T> CloneToUninit for T where T: Clone , Source § 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 Source § impl<T> From <T> for T Source § fn from (t: T) -> T Returns the argument unchanged.
Source § impl<T> Init <T> for T Source § fn chain <F>(self, f: F) -> ChainInit <Self, F, T, E> where F: FnOnce ( &mut T ) -> Result < () , E>, First initializes the value using self then calls the function f with the initialized value. Read more Source § impl<T, U> Into <U> for T where U: From <T>, Source § fn into (self) -> U Calls U::from(self) . That is, this conversion is whatever the implementation of From <T> for U chooses to do.
Source § impl<S, T> IntoSafeCast <T> for S where T: FromSafeCast <S>, Source § fn into_safe_cast (self) -> T Convert self into a T . This operation is guaranteed to be lossless. Source § impl<S, T> IntoSafeCastArch <T> for S where T: FromSafeCastArch <S>, Source § fn into_safe_cast_arch (self) -> T Convert self into a T . This operation is guaranteed to be lossless. Source § impl<T> KnownSize for T Source § const MIN_SIZE : usize = const MIN_SIZE: usize = size_of::<T>(); Minimum size of this type known at compile-time.
Source § const MIN_ALIGN : Alignment = const MIN_ALIGN: Alignment = Alignment::of::<T>(); Minimum alignment of this type known at compile-time. Source § fn size (_: *const T ) -> usize Get the size of an object of this type in bytes, with the metadata of the given pointer. Source § impl<T> PinInit <T> for T Source § unsafe fn __init (self, slot: *mut T ) -> Result < () , ! > Initializes slot . Read more Source § fn pin_chain <F>(self, f: F) -> ChainPinInit <Self, F, T, E> where F: FnOnce ( Pin < &mut T >) -> Result < () , E>, First initializes the value using self then calls the function f with the initialized value.
Read more Source § impl<T> Read < Exclusive , BecauseExclusive > for T where T: ? Sized , Source § impl<T, U> TryFrom <U> for T where U: Into <T>, Source § type Error = ! The type returned in the event of a conversion error. Source § fn try_from (value: U) -> Result <T, ! > Performs the conversion. Source § impl<T, U> TryInto <U> for T where U: TryFrom <T>, Source § type Error = <U as TryFrom <T>>:: Error The type returned in the event of a conversion error.
Source § fn try_into (self) -> Result <U, <U as TryFrom <T>>:: Error > Performs the conversion. Source § impl<T, U, const N: u32 > TryIntoBounded <T, N> for U where T: Integer , U: TryInto <T>, Source § fn try_into_bounded (self) -> Option < Bounded <T, N>> Attempts to convert self into
The rest of this page is on the live site.