Reimplementation of the private std::sys::cvt()
, but as a trait method.
Example
use cvt_trait::prelude::*;
# use std::os::raw::c_int;
# #[cfg(unix)]
# unsafe fn os_api() -> c_int {
# 0
# }
# #[cfg(windows)]
# unsafe fn os_api() -> c_int {
# 1
# }
unsafe { os_api() }.cvt().expect("OS API failed");