pub struct Win32Error(/* private fields */);Expand description
A raw Win32 error code, exactly as Windows produced it.
Deliberately not an enum: the point of this type is that it carries whatever Windows said, including codes this crate has never heard of.
§Example
use windows_namespace_request_sys::Win32Error;
use windows_sys::Win32::Foundation::ERROR_FILE_NOT_FOUND;
let error = Win32Error::from_code(ERROR_FILE_NOT_FOUND);
assert_eq!(error.code(), ERROR_FILE_NOT_FOUND);
// The io::Error form is a re-presentation, not a reclassification: the raw
// code survives it.
assert_eq!(error.to_io_error().raw_os_error(), Some(ERROR_FILE_NOT_FOUND as i32));
// A code this crate has never heard of is carried just the same.
let unknown = Win32Error::from_code(0x0BAD_F00D);
assert_eq!(unknown.code(), 0x0BAD_F00D);Implementations§
Source§impl Win32Error
impl Win32Error
Sourcepub fn to_io_error(self) -> Error
pub fn to_io_error(self) -> Error
The same failure as a standard io::Error, for callers that funnel
everything through std::io.
This is a re-presentation, not a reclassification: the raw code survives
as io::Error::raw_os_error.
Trait Implementations§
Source§impl Clone for Win32Error
impl Clone for Win32Error
Source§fn clone(&self) -> Win32Error
fn clone(&self) -> Win32Error
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for Win32Error
Source§impl Debug for Win32Error
impl Debug for Win32Error
Source§impl Display for Win32Error
impl Display for Win32Error
impl Eq for Win32Error
Source§impl Error for Win32Error
impl Error for Win32Error
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 From<Win32Error> for FinalPathError
impl From<Win32Error> for FinalPathError
Source§fn from(error: Win32Error) -> Self
fn from(error: Win32Error) -> Self
Converts to this type from the input type.
Source§impl From<Win32Error> for FullPathError
impl From<Win32Error> for FullPathError
Source§fn from(error: Win32Error) -> Self
fn from(error: Win32Error) -> Self
Converts to this type from the input type.
Source§impl Hash for Win32Error
impl Hash for Win32Error
Source§impl PartialEq for Win32Error
impl PartialEq for Win32Error
impl StructuralPartialEq for Win32Error
Auto Trait Implementations§
impl Freeze for Win32Error
impl RefUnwindSafe for Win32Error
impl Send for Win32Error
impl Sync for Win32Error
impl Unpin for Win32Error
impl UnsafeUnpin for Win32Error
impl UnwindSafe for Win32Error
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