1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Copied from https://github.com/svartalf/rust-battery/blob/master/battery/src/platform/darwin/iokit/errors.rs

#[macro_export]
macro_rules! r#kern_try {
    ($expr:expr) => {
        match $expr {
            mach2::kern_return::KERN_SUCCESS => (),
            err_code => return ::std::result::Result::Err(::std::io::Error::from_raw_os_error(err_code).into()),
        }
    };
    ($expr:expr,) => {
        r#kern_try!($expr)
    };
}