| Crates.io | attempted |
| lib.rs | attempted |
| version | 0.1.0 |
| created_at | 2022-08-28 14:14:02.868544+00 |
| updated_at | 2022-08-28 14:14:02.868544+00 |
| description | Wrap a function with 'unwrap or return' |
| homepage | |
| repository | https://github.com/ChangeCaps/attempted |
| max_upload_size | |
| id | 653884 |
| size | 4,925 |
fn positive(x: i32) -> Option<i32> {
if x > 0 {
Some(x)
} else {
None
}
}
#[attempt]
fn test() {
// try something
let x = positive(13)?;
// do something with x
println!("{} is positive", x);
}