Julio Biason
4 months ago
3 changed files with 23 additions and 0 deletions
@ -0,0 +1,7 @@ |
|||||||
|
# This file is automatically @generated by Cargo. |
||||||
|
# It is not intended for manual editing. |
||||||
|
version = 3 |
||||||
|
|
||||||
|
[[package]] |
||||||
|
name = "andthenchaintest" |
||||||
|
version = "0.1.0" |
@ -0,0 +1,6 @@ |
|||||||
|
[package] |
||||||
|
name = "andthenchaintest" |
||||||
|
version = "0.1.0" |
||||||
|
edition = "2021" |
||||||
|
|
||||||
|
[dependencies] |
@ -0,0 +1,10 @@ |
|||||||
|
fn main() { |
||||||
|
let value: Result<u32, u32> = Err(20) |
||||||
|
.map_err(|_: u32| 30) |
||||||
|
.and_then(|_old: u32| Err(40)); |
||||||
|
|
||||||
|
// Note: Order does not affect these results; even if `.map_err()` comes before `.and_then()`,
|
||||||
|
// when `.and_then()` returns an error, it is captured by `.map_err()` again.
|
||||||
|
|
||||||
|
println!("{:?}", value); |
||||||
|
} |
Loading…
Reference in new issue