[−][src]Struct kvm_ioctls::Error
Wrapper over errno
.
The error number is an integer number set by system calls and some libc functions in case of error.
Methods
impl Error
[src]
pub fn new(errno: i32) -> Error
[src]
Creates a new error from the given error number.
Arguments
errno
: error number used for creating theError
.
Examples
extern crate vmm_sys_util; use vmm_sys_util::errno::Error; let err = Error::new(libc::EBADFD);
pub fn last() -> Error
[src]
Returns the last occurred errno
wrapped in an Error
.
Calling Error::last()
is the equivalent of using
errno
in C/C++.
The result of this function only has meaning after a libc call or syscall
where errno
was set.
Examples
extern crate vmm_sys_util; use vmm_sys_util::errno::Error; // Writing to an invalid file returns the error number EBADF. let mut file = unsafe { File::from_raw_fd(-1) }; let _ = file.write(b"test"); // Retrieve the error number of the previous operation using `Error::last()`: let write_err = Error::last(); assert_eq!(write_err, Error::new(libc::EBADF));
pub fn errno(self) -> i32
[src]
Returns the raw integer value (errno
) corresponding to this Error.
Examples
extern crate vmm_sys_util; use vmm_sys_util::errno::Error; let err = Error::new(13); assert_eq!(err.errno(), 13);
Trait Implementations
impl Clone for Error
[src]
impl Debug for Error
[src]
impl StructuralPartialEq for Error
[src]
impl Display for Error
[src]
impl From<Error> for Error
[src]
impl Copy for Error
[src]
impl PartialEq<Error> for Error
[src]
Auto Trait Implementations
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
impl RefUnwindSafe for Error
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
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>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,