| Crates.io | fu |
| lib.rs | fu |
| version | 0.1.1 |
| created_at | 2024-10-11 03:15:02.249454+00 |
| updated_at | 2024-10-11 14:38:31.22264+00 |
| description | Just an Error |
| homepage | |
| repository | https://github.com/jocades/fu |
| max_upload_size | |
| id | 1404867 |
| size | 7,873 |
Just an Error with its location and helpful macros.
Error type with file name, line, and column information.error!, bail!, and ensure!.use fu::{bail, ensure, Result};
const MAX: i32 = 10;
fn example(value: i32) -> Result<()> {
ensure!(value >= 0, "value must be non-negative");
if value > MAX {
bail!("value is larger than {}", MAX);
}
Ok(())
}
fn main() -> Result<()> {
example(-1)
}
// Error: value must be non-negative examples/foo.rs:[4:5]