Yuki Okushi
961d51dcbb
Rollup merge of #66292 - lzutao:result-map_or, r=SimonSapin
...
add Result::map_or
This PR adds this API to make it consistent with `Option::map_or`.
```rust
impl<T, E> Result<T, E> {
pub fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U {
match self {
Ok(t) => f(t),
Err(_) => default,
}
}
}
```
This API is very small. We already has a similar API for `Option::map_or`.
2019-11-13 22:09:20 +09:00
..
2019-11-13 22:09:13 +09:00
2019-11-13 22:09:13 +09:00
2019-11-13 03:48:42 +00:00
2019-11-13 22:09:20 +09:00
2019-11-13 00:42:19 +00:00
2019-11-12 16:36:57 -05:00
2019-11-13 22:09:15 +09:00
2019-11-10 12:21:05 +01:00
2019-11-11 15:14:37 -05:00
2019-11-10 12:21:05 +01:00
2019-11-12 16:36:12 +09:00
2019-11-11 22:23:25 +03:00
2019-11-10 12:18:53 +00:00
2019-11-10 03:57:18 +01:00
2019-11-10 12:21:05 +01:00
2019-11-11 14:05:43 +00:00
2019-11-12 21:27:04 +00:00
2019-11-10 03:57:18 +01:00
2019-11-11 14:05:43 +00:00
2019-11-09 17:50:51 +03:00
2019-11-10 15:53:35 +00:00
2019-11-10 03:57:18 +01:00
2019-11-12 16:36:07 +09:00
2019-11-10 12:31:41 +01:00
2019-11-12 21:27:04 +00:00
2019-11-13 22:09:13 +09:00
2019-11-13 22:09:17 +09:00
2019-11-13 22:09:13 +09:00
2019-11-10 03:57:18 +01:00
2019-11-11 08:04:39 +01:00
2019-11-12 16:36:57 -05:00
2019-11-12 11:02:17 +01:00
2019-11-13 22:09:15 +09:00
2019-11-12 16:36:57 -05:00
2019-11-12 16:36:57 -05:00