[−][src]Struct illicit::Snapshot
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()); });
Snapshot
s can also be converted back into Layer
s 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
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]
T: 'static + ?Sized,
impl<T> AsContext for T where
T: Debug + 'static,
[src]
T: Debug + 'static,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,