impl transposed form of MapExpect
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -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)) }
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user