Struct illicit::Snapshot [−][src]
pub struct Snapshot { /* fields omitted */ }Expand description
A point-in-time representation of the implicit environment.
Examples
Collecting a Snapshot is useful for debugging:
illicit::Layer::new().offer(5u16).enter(|| {
println!("{:#?}", illicit::Snapshot::get());
});Snapshots can also be converted back into Layers for re-use:
let mut snapshot = None;
illicit::Layer::new().offer(5u16).enter(|| {
assert_eq!(*illicit::expect::<u16>(), 5);
snapshot = Some(illicit::Snapshot::get());
});
assert!(illicit::get::<u16>().is_err());
illicit::Layer::from(snapshot.unwrap()).enter(|| {
assert_eq!(*illicit::expect::<u16>(), 5);
});Implementations
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Snapshot
impl UnwindSafe for Snapshot
Blanket Implementations
Mutably borrows from an owned value. Read more