[][src]Struct kvm_ioctls::Error

pub struct 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 the Error.

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]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]