Documentation
  • Coverage
  • 77.78%
    7 out of 9 items documented5 out of 6 items with examples
  • Size
  • Source code size: 7.4 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.45 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • jocades/fu
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jocades

Fu

Just an Error with its location and helpful macros.

  • Custom Error type with file name, line, and column information.
  • Short and convenient macros: error!, bail!, and ensure!.
  • Lightweight.

Usage

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]