pub struct Guard<T: RefCnt, S: Strategy<T> = DefaultStrategy> { /* 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
sourceimpl<'a, T: RefCnt, S: Strategy<T>> Guard<T, S>
 
impl<'a, T: RefCnt, S: Strategy<T>> Guard<T, S>
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::<_, DefaultStrategy>::from_inner(Arc::clone(&*g1));Trait Implementations
Auto Trait Implementations
impl<T, S> RefUnwindSafe for Guard<T, S> where
    <S as InnerStrategy<T>>::Protected: RefUnwindSafe, 
impl<T, S> Send for Guard<T, S> where
    <S as InnerStrategy<T>>::Protected: Send, 
impl<T, S> Sync for Guard<T, S> where
    <S as InnerStrategy<T>>::Protected: Sync, 
impl<T, S> Unpin for Guard<T, S> where
    <S as InnerStrategy<T>>::Protected: Unpin, 
impl<T, S> UnwindSafe for Guard<T, S> where
    <S as InnerStrategy<T>>::Protected: UnwindSafe, 
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, A> DynAccess<T> for A where
    A: Access<T>,
    <A as Access<T>>::Guard: 'static, 
 
impl<T, A> DynAccess<T> for A where
    A: Access<T>,
    <A as Access<T>>::Guard: 'static, 
sourcefn load(&self) -> DynGuard<T>
 
fn load(&self) -> DynGuard<T>
The equivalent of Access::load.