Struct illicit::Snapshot [−][src]
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
[src]
impl !Send for Snapshot
[src]
impl !Sync for Snapshot
[src]
impl Unpin for Snapshot
[src]
impl UnwindSafe for Snapshot
[src]
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,