diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-11-13 22:09:20 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-13 22:09:20 +0900 |
| commit | 961d51dcbb3e62593367752ca354ea05ad93ac03 (patch) | |
| tree | 1011e28062bfc8640abd0b5946995abd30aadb55 /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 689cc046146faa7a8b0970614c84a3d9ca00ae84 (diff) | |
| parent | e8f3a9ffbe0dc435d43767b31cc122ccc325f4c1 (diff) | |
| download | rust-961d51dcbb3e62593367752ca354ea05ad93ac03.tar.gz rust-961d51dcbb3e62593367752ca354ea05ad93ac03.zip | |
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`.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
