pub struct Scope<'env> { /* private fields */ }Expand description
Type representing a scope for encapsulated references
Most user code shouldn’t have to directly use this. It is primarily for implementing
Encapsulate. It can convert a &T or &mut T into a Capsule<T> or CapsuleMut<T>
respectively. A typical implementation of Encapsulate will project embedded reference
types from the source type to capsule types in the destination types, using the methods on
Scope.
Implementations§
Source§impl<'env> Scope<'env>
impl<'env> Scope<'env>
Sourcepub fn encapsulate<T: ?Sized + Sync>(&self, data: &'env T) -> Capsule<T>
pub fn encapsulate<T: ?Sized + Sync>(&self, data: &'env T) -> Capsule<T>
Encapsulate a &T so it can be passed to another thread.
Sourcepub fn encapsulate_mut<T: ?Sized + Sync>(
&self,
data: &'env mut T,
) -> CapsuleMut<T>
pub fn encapsulate_mut<T: ?Sized + Sync>( &self, data: &'env mut T, ) -> CapsuleMut<T>
Encapsulate a &mut T so it can be passed to another thread.
Auto Trait Implementations§
impl<'env> Freeze for Scope<'env>
impl<'env> RefUnwindSafe for Scope<'env>
impl<'env> Send for Scope<'env>
impl<'env> Sync for Scope<'env>
impl<'env> Unpin for Scope<'env>
impl<'env> !UnwindSafe for Scope<'env>
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