impl transposed form of MapExpect

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-12-01 09:18:35 +00:00
parent 9263439af8
commit 3fbd74310f

View file

@ -13,3 +13,8 @@ impl<'a, T, E: Debug> MapExpect<'a, Option<T>> for Option<Result<T, E>> {
#[inline] #[inline]
fn map_expect(self, msg: &'a str) -> Option<T> { self.map(|result| result.expect(msg)) } fn map_expect(self, msg: &'a str) -> Option<T> { self.map(|result| result.expect(msg)) }
} }
impl<'a, T, E: Debug> MapExpect<'a, Result<T, E>> for Result<Option<T>, E> {
#[inline]
fn map_expect(self, msg: &'a str) -> Result<T, E> { self.map(|result| result.expect(msg)) }
}