impl transposed form of MapExpect
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
9263439af8
commit
3fbd74310f
1 changed files with 5 additions and 0 deletions
|
@ -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)) }
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue