Skip to main content

contain

Function contain 

Source
pub fn contain<T, F>(f: F) -> Result<T, DecodeError>
where F: FnOnce() -> Result<T, DecodeError> + UnwindSafe,
Expand description

Runs f, a panic in it becoming DecodeError::Panicked with its payload. f charges nothing (module docs), and must be UnwindSafe: a caller whose closure writes into a buffer it then drops on the error asserts so itself (std::panic::AssertUnwindSafe), as crate::decode() does.