[][src]Struct w32_error::W32Error

#[must_use = "this `W32Error` is unhandled"]#[repr(transparent)]pub struct W32Error(_);

A Windows API error.

Methods

impl W32Error[src]

pub const fn new(code: DWORD) -> Self[src]

Wraps an arbitrary error code.

Examples

let error = W32Error::new(0);
println!("{}", error);

pub fn from_io_error(other: &Error) -> Option<Self>[src]

Wraps the error code from an io::Error if it has one.

Examples

use std::io;
let io_error = io::Error::from_raw_os_error(0);
let opt = W32Error::from_io_error(&io_error);
assert_eq!(opt, Some(W32Error::new(0)));

pub fn last_thread_error() -> Self[src]

Wraps the error code that is currently set for the calling thread.

This is equivalent to calling the Windows API function GetLastError and passing the return value to W32Error::new.

Examples

let error = W32Error::last_thread_error();
println!("{}", error);

pub const fn into_inner(self) -> DWORD[src]

Returns the underlying error code wrapped by a W32Error.

Examples

assert_eq!(W32Error::new(0).into_inner(), 0);

Trait Implementations

impl Clone for W32Error[src]

impl Copy for W32Error[src]

impl Debug for W32Error[src]

impl Display for W32Error[src]

impl Eq for W32Error[src]

impl Error for W32Error[src]

impl From<W32Error> for Error[src]

impl From<W32Error> for DWORD[src]

impl From<u32> for W32Error[src]

impl Hash for W32Error[src]

impl Ord for W32Error[src]

impl PartialEq<W32Error> for W32Error[src]

impl PartialOrd<W32Error> for W32Error[src]

impl StructuralEq for W32Error[src]

impl StructuralPartialEq for W32Error[src]

impl TryFrom<Error> for W32Error[src]

type Error = TryFromIoError

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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 = Infallible

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.