ResultExt

Trait ResultExt 

Source
pub trait ResultExt<T> {
    // Required methods
    fn from_win32() -> Result<()>;
    fn err_from_win32() -> Result<T>;
    fn from_checked_or_win32<F>(t: T, check: F) -> Result<T>
       where F: FnOnce(&T) -> bool;
    fn from_checked_or_e_fail<F>(t: T, check: F) -> Result<T>
       where F: FnOnce(&T) -> bool;
}

Required Methods§

Source

fn from_win32() -> Result<()>

Returns Ok(()), or Err, based on windows::core::Error::from_win32().

Source

fn err_from_win32() -> Result<T>

Source

fn from_checked_or_win32<F>(t: T, check: F) -> Result<T>
where F: FnOnce(&T) -> bool,

Passes a T through to an Ok value, if the check is successful, or otherwise returns Err with windows::core::Error::from_win32().

Can be used transitionally in new cases, until this crate might offer a more suitable solution.

Source

fn from_checked_or_e_fail<F>(t: T, check: F) -> Result<T>
where F: FnOnce(&T) -> bool,

Passes a T through to an Ok value, if the check is successful, or otherwise returns Err with HRESULT E_FAIL.

To be used with functions that don’t offer an error code via GetLastError().

Can be used transitionally in new cases, until this crate might offer a more suitable solution.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> ResultExt<T> for Result<T>

Source§

fn from_win32() -> Result<()>

Source§

fn err_from_win32() -> Result<T>

Source§

fn from_checked_or_win32<F>(t: T, check: F) -> Result<T>
where F: FnOnce(&T) -> bool,

Source§

fn from_checked_or_e_fail<F>(t: T, check: F) -> Result<T>
where F: FnOnce(&T) -> bool,

Implementors§