about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-11-13 22:09:20 +0900
committerGitHub <noreply@github.com>2019-11-13 22:09:20 +0900
commit961d51dcbb3e62593367752ca354ea05ad93ac03 (patch)
tree1011e28062bfc8640abd0b5946995abd30aadb55 /src/libstd/sys/unix/stack_overflow.rs
parent689cc046146faa7a8b0970614c84a3d9ca00ae84 (diff)
parente8f3a9ffbe0dc435d43767b31cc122ccc325f4c1 (diff)
downloadrust-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