[][src]Macro comedy::check_succeeded

macro_rules! check_succeeded {
    ($f:ident ( $($arg:expr),* )) => { ... };
    ($f:ident ( $($arg:expr),+ , )) => { ... };
}

Call a function that returns an HRESULT, convert to a Result.

The error will be augmented with the name of the function and the file and line number of the macro usage.

Example

fn coinit() -> Result<(), HResult> {
    unsafe {
        check_succeeded!(CoInitialize(ptr::null_mut()))?;

        CoUninitialize();
    }
    Ok(())
}