As of 1.65, it is possible to use let statement with a refutable pattern.
1
2
3
4
5
6
7
let result: Result<i32, ()> = Ok(20);
let Ok(value) = result else {
panic!("Heeeelp!!!");
};
assert_eq!(value, 20);
As of 1.65, it is possible to use let statement with a refutable pattern.
1
2
3
4
5
6
7
let result: Result<i32, ()> = Ok(20);
let Ok(value) = result else {
panic!("Heeeelp!!!");
};
assert_eq!(value, 20);
A new version of content is available.