pub struct Snapshot { /* private fields */ }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 Freeze for Snapshot
impl RefUnwindSafe for Snapshot
impl !Send for Snapshot
impl !Sync for Snapshot
impl Unpin for Snapshot
impl UnsafeUnpin for Snapshot
impl UnwindSafe for Snapshot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more