Function std::rt::unwind::tryExperimental [-]  [+] [src]

pub unsafe fn try<F: FnOnce()>(f: F) -> Result<(), Box<Any + Send>>

Invoke a closure, capturing the cause of panic if one occurs.

This function will return None if the closure did not panic, and will return Some(cause) if the closure panics. The cause returned is the object with which panic was originally invoked.

This function also is unsafe for a variety of reasons: