macro_rules! wrap_winapi {
($call:expr, x $($tt:tt)*) => { ... };
}
Expand description
Wrap a function to a lambda which returns a Result<_, Error> depending of the condition. You should use it like wrap_winapi!(MyFunction(), MyCondition) where MyCondition must start with an x and the comparison. For example
// This should fail since we are saying that
// when the return value equals to 0 it's an error.
assert!(wrap_winapi!((|| 0)(), x == 0).is_err());