use std::fmt::Debug; use super::Result; pub trait MapExpect { /// Calls expect(msg) on the mapped Result value. This is similar to /// map(Result::unwrap) but composes an expect call and message without /// requiring a closure. fn map_expect(self, msg: &str) -> Option; } impl MapExpect for Option> { #[inline] fn map_expect(self, msg: &str) -> Option { self.map(|result| result.expect(msg)) } }