1 unstable release

0.1.0 Jul 28, 2019

#1736 in Filesystem

MIT/Apache

12KB
222 lines

efuse

Build Status crates.io LoC Documentation

A Rust library for software fuses.

This library provides boolean-like types that behave like software fuses: they can be "zapped" once, after which they remain in the toggled state forever. It supports fuses with custom initial boolean state, as well as atomic fuses.

Example

let initial_state = true;
let mut fuse = efuse::Fuse::new(initial_state);
assert_eq!(fuse.as_bool(), true);

fuse.zap();
assert_eq!(fuse.is_zapped(), true);
assert_eq!(fuse.as_bool(), false);

fuse.zap();
assert_eq!(fuse.as_bool(), false);

let already_zapped = fuse.zap_once();
assert!(already_zapped.is_err());

License

Licensed under either of

at your option.

No runtime deps