pub struct InContext<'a, D: Contextual> { /* private fields */ }Expand description
A short-term binding of Context and any immutable object of a
type that implements the Contextual trait.
The purpose of this type is to allow a transparent read access to
shared data, like names etc. To prevent coarse-grained locking,
Context is internally represented by a ContextHandle;
however, Context can’t be modified through InContext.
Implementations§
Source§impl<D: Contextual> InContext<'_, D>
impl<D: Contextual> InContext<'_, D>
pub fn using_context<T, F>(&self, f: F) -> T
pub fn same_context(&self, other: &Self) -> bool
pub fn get_context(&self) -> &ContextHandle
pub fn get_thing(&self) -> &D
Trait Implementations§
Auto Trait Implementations§
impl<'a, D> Freeze for InContext<'a, D>
impl<'a, D> RefUnwindSafe for InContext<'a, D>where
D: RefUnwindSafe,
impl<'a, D> Send for InContext<'a, D>where
D: Sync,
impl<'a, D> Sync for InContext<'a, D>where
D: Sync,
impl<'a, D> Unpin for InContext<'a, D>
impl<'a, D> UnwindSafe for InContext<'a, D>where
D: RefUnwindSafe,
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