pub struct W32Error(/* private fields */);
Expand description
A Windows API error.
Implementations§
Source§impl W32Error
impl W32Error
Sourcepub fn from_io_error(other: &Error) -> Option<Self>
pub fn from_io_error(other: &Error) -> Option<Self>
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)));
Sourcepub fn last_thread_error() -> Self
pub fn last_thread_error() -> Self
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);
Sourcepub const fn into_inner(self) -> DWORD
pub const fn into_inner(self) -> DWORD
Returns the underlying error code wrapped by a W32Error
.
§Examples
assert_eq!(W32Error::new(0).into_inner(), 0);
Trait Implementations§
Source§impl Error for W32Error
impl Error for W32Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl Ord for W32Error
impl Ord for W32Error
Source§impl PartialOrd for W32Error
impl PartialOrd for W32Error
impl Copy for W32Error
impl Eq for W32Error
impl StructuralPartialEq for W32Error
Auto Trait Implementations§
impl Freeze for W32Error
impl RefUnwindSafe for W32Error
impl Send for W32Error
impl Sync for W32Error
impl Unpin for W32Error
impl UnwindSafe for W32Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more