[][src]Struct illicit::Snapshot

pub struct Snapshot { /* fields omitted */ }

A point-in-time representation of the implicit environment.


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

illicit::Layer::from(snapshot.unwrap()).enter(|| {
    assert_eq!(*illicit::expect::<u16>(), 5);


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

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> Erased for T

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.