Struct Error
pub struct Error { /* private fields */ }Expand description
A Windows error code with optional COM error information.
§Extended error information
By default, Error retains an IErrorInfo object when available. This may include a message,
source, and WinRT stack trace.
Set RUSTFLAGS=--cfg=windows_slim_errors to omit IErrorInfo. This reduces Error to the
four-byte HRESULT and removes its Drop implementation, but discards extended information.
This is controlled by a --cfg option rather than a Cargo feature because this compilation
option sets a policy that applies to an entire graph of crates. Individual crates that take a
dependency on the windows-result crate are not in a good position to decide whether they want
slim errors or full errors. Cargo features are meant to be additive, but specifying the size
and contents of Error is not a feature so much as a whole-program policy decision.
§References
Implementations§
Source§impl Error
impl Error
Sourcepub fn new<T>(code: HRESULT, message: T) -> Error
pub fn new<T>(code: HRESULT, message: T) -> Error
Creates a new error object, capturing the stack and other information about the point of failure.
Sourcepub fn from_hresult(code: HRESULT) -> Error
pub fn from_hresult(code: HRESULT) -> Error
Creates a new error object with an error code, but without additional error information.
Sourcepub fn from_thread() -> Error
pub fn from_thread() -> Error
Creates a new Error from the Win32 error code returned by GetLastError().
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()