1 unstable release

0.1.0 Jan 24, 2025

#5 in #unreachable

Download history 4186/week @ 2025-11-12 1773/week @ 2025-11-19 542/week @ 2025-11-26 2063/week @ 2025-12-03 2887/week @ 2025-12-10 857/week @ 2025-12-17 97/week @ 2025-12-24 1207/week @ 2025-12-31 2166/week @ 2026-01-07 2538/week @ 2026-01-14 4212/week @ 2026-01-21 1812/week @ 2026-01-28 1815/week @ 2026-02-04 2363/week @ 2026-02-11 2957/week @ 2026-02-18 26409/week @ 2026-02-25

34,179 downloads per month
Used in 28 crates (15 directly)

BSD-3-Clause

8KB
135 lines

spideroak-core

SpiderOak's core rust crates


lib.rs:

Error handling similar to core::unreachable, but less panicky.

Configuration

Panicking is controlled by debug_assertions.

  • By default, in debug/test builds, we panic to make it easier to find bugs.
  • In release builds, we don't want to panic so we instead return Result<T, [Bug]>.

Usage

use buggy::{bug, Bug, BugExt};

#[derive(Debug)]
enum MyError {
    TooManyFrobs,
    Bug(Bug),
}

impl From<Bug> for MyError {
    fn from(err: Bug) -> Self {
        Self::Bug(err)
    }
}

fn main() -> Result<(), MyError> {
    let x: u32 = 42;

    let sum = x.checked_add(100).assume("x is small")?;

    if x % 2 != 0 {
        bug!("x is always even because I said so");
    }

    Ok(())
}

Dependencies

~4KB