Crate efuse

Source
Expand description

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);

let value = fuse.zap();
assert_eq!(value, false);

let already_zapped = fuse.zap_once();
assert_eq!(already_zapped, Err(efuse::AlreadyZappedError));

Structs§

  • Attempted to zap_once an already zapped fuse.
  • Atomic software fuse, with custom initial state.
  • Software fuse, with custom initial state.