[][src]Struct illicit::Snapshot

pub struct Snapshot { /* fields omitted */ }

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

impl Snapshot[src]

pub fn get() -> Self[src]

Returns a snapshot of the current context. Suitable for debug printing, or can be converted into a Layer for reuse.

Trait Implementations

impl Clone for Snapshot[src]

impl Debug for Snapshot[src]

impl From<Snapshot> for Layer[src]

Auto Trait Implementations

impl RefUnwindSafe for Snapshot

impl !Send for Snapshot

impl !Sync for Snapshot

impl Unpin for Snapshot

impl UnwindSafe for Snapshot

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsContext for T where
    T: Debug + 'static, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.