pub struct Guard<'l, T: RefCnt> { /* private fields */ }
Expand description
A temporary storage of the pointer.
This guard object is returned from most loading methods (with the notable exception of
load_full
). It dereferences to the smart pointer
loaded, so most operations are to be done using that.
Implementations§
source§impl<'a, T: RefCnt> Guard<'a, T>
impl<'a, T: RefCnt> Guard<'a, T>
sourcepub fn into_inner(lease: Self) -> T
pub fn into_inner(lease: Self) -> T
Converts it into the held value.
This, on occasion, may be a tiny bit faster than cloning the Arc or whatever is being held inside.
sourcepub fn from_inner(inner: T) -> Self
pub fn from_inner(inner: T) -> Self
Create a guard for a given value inner
.
This can be useful on occasion to pass a specific object to code that expects or wants to store a Guard.
Example
// Create two guards pointing to the same object
let g1 = p.load();
let g2 = Guard::from_inner(Arc::clone(&*g1));
Trait Implementations§
Auto Trait Implementations§
impl<'l, T> RefUnwindSafe for Guard<'l, T>where
T: RefUnwindSafe,
impl<'l, T> Send for Guard<'l, T>where
T: Send,
impl<'l, T> Sync for Guard<'l, T>where
T: Sync,
impl<'l, T> Unpin for Guard<'l, T>where
T: Unpin,
impl<'l, T> UnwindSafe for Guard<'l, T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T, A> DynAccess<T> for Awhere
A: Access<T>,
<A as Access<T>>::Guard: 'static,
impl<T, A> DynAccess<T> for Awhere
A: Access<T>,
<A as Access<T>>::Guard: 'static,
source§fn load(&self) -> DynGuard<T>
fn load(&self) -> DynGuard<T>
The equivalent of
Access::load
.