#[cfg(not(target_os = "macos"))]
pub(crate) mod unsupported;
#[cfg(target_os = "macos")]
pub(crate) use crate::bridge::ffi;
#[cfg(not(target_os = "macos"))]
pub(crate) use self::unsupported as ffi;
const FAILED: i32 = -1;
#[cfg(target_os = "macos")]
pub(crate) fn checked(code: i32, action: impl Into<String>) -> Result<i32, crate::Error> {
if code == FAILED {
return Err(crate::Error::failed(action, ffi::czbridge_last_error()));
}
Ok(code)
}
#[cfg(not(target_os = "macos"))]
pub(crate) fn checked(code: i32, action: impl Into<String>) -> Result<i32, crate::Error> {
if code == FAILED {
return Err(crate::Error::unavailable(
action,
"Containerization.framework is macOS only",
));
}
Ok(code)
}