Debian Codegraph @

third_party/rust/objc/src/exception.rs

raw
1 use objc_exception;
2
3 use rc::StrongPtr;
4 use runtime::Object;
5
6 pub unsafe fn try<F, R>(closure: F) -> Result<R, StrongPtr>
7 where F: FnOnce() -> R {
8 objc_exception::try(closure).map_err(|exception| {
9 StrongPtr::new(exception as *mut Object)
10 })
11 }