[−][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.
Implementations
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::EIO);
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; // Reading from a file without permissions returns an error. let mut path = temp_dir(); path.push("test"); let mut file = File::create(path).unwrap(); let mut buf: Vec<u8> = Vec::new(); assert!(file.read_to_end(&mut buf).is_err()); // Retrieve the error number of the previous operation using `Error::last()`: let read_err = Error::last(); #[cfg(unix)] assert_eq!(read_err, Error::new(libc::EBADF)); #[cfg(not(unix))] assert_eq!(read_err, Error::new(libc::EIO));
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 Copy for Error
[src]
impl Debug for Error
[src]
impl Display for Error
[src]
impl Error for Error
[src]
pub fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0[src]
pub fn backtrace(&self) -> Option<&Backtrace>
[src]
pub fn description(&self) -> &str
1.0.0[src]
pub fn cause(&self) -> Option<&dyn Error>
1.0.0[src]
impl From<Error> for Error
[src]
impl PartialEq<Error> for Error
[src]
impl StructuralPartialEq for Error
[src]
Auto Trait Implementations
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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 = Infallible
The type returned in the event of a conversion error.
pub 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>,