Registry / utility / snafu
library0.9.1rscratesunverified

An ergonomic error handling library.

# Cargo.toml [dependencies] snafu = "0.9.1"
INSTALL
IMPORT
SIG · SNAFU
S
snafu
utilityrustv0.9.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Snafu
use snafu::Snafu;

Define and use custom error types

use snafu::Snafu; #[derive(Debug, Snafu)] #[snafu(display("Invalid input: {}", message))] pub struct InvalidInput { message: String, } fn validate(input: &str) -> Result<(), InvalidInput> { if input.is_empty() { return InvalidInput { message: "empty".into() }.fail(); } Ok(()) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.9.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
snafu — cargo add snafu · libregistry