pub trait CheckNumberError
where Self: Zero + Sized,
{ // Required methods fn nonzero_with_win32_or_err(self) -> Result<Self>; fn nonzero_or_win32_err(self) -> Result<Self>; fn nonzero_or_e_fail(self) -> Result<Self>; }

Required Methods§

source

fn nonzero_with_win32_or_err(self) -> Result<Self>

Passes a non-zero self through to an Ok value, or, in case of it being zero, returns Err with [windows::core::Error::from_win32()], if it yields an error code, or Ok(0) otherwise.

To be used with functions that communicate valid values as well as errors by a return value of 0 and need an additional call to GetLastError() to check whether an error has occurred (e.g., SetWindowLongPtrW()). Note that, depending on whether the function calls SetLastError() under all circumstances, you may need to precede the call for which you call this function by SetLastError(ERROR_SUCCESS).

source

fn nonzero_or_win32_err(self) -> Result<Self>

Passes a non-zero self through to an Ok value, or, in case of it being zero, returns Err with [windows::core::Error::from_win32()].

source

fn nonzero_or_e_fail(self) -> Result<Self>

Passes a non-zero self through to an Ok value, or, in case of it being zero, returns Err with HRESULT E_FAIL.

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

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> CheckNumberError for T
where T: Zero,