Struct arc_swap::Guard [−][src]
pub struct Guard<T: RefCnt, S: Strategy<T> = DefaultStrategy> { /* fields omitted */ }
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
impl<'a, T: RefCnt, S: Strategy<T>> Guard<T, S>
[src]
impl<'a, T: RefCnt, S: Strategy<T>> Guard<T, S>
[src]pub fn into_inner(lease: Self) -> T
[src]
pub fn into_inner(lease: Self) -> T
[src]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.
pub fn from_inner(inner: T) -> Self
[src]
pub fn from_inner(inner: T) -> Self
[src]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,
<S as InnerStrategy<T>>::Protected: RefUnwindSafe,
impl<T, S> Send for Guard<T, S> where
<S as InnerStrategy<T>>::Protected: Send,
<S as InnerStrategy<T>>::Protected: Send,
impl<T, S> Sync for Guard<T, S> where
<S as InnerStrategy<T>>::Protected: Sync,
<S as InnerStrategy<T>>::Protected: Sync,
impl<T, S> Unpin for Guard<T, S> where
<S as InnerStrategy<T>>::Protected: Unpin,
<S as InnerStrategy<T>>::Protected: Unpin,
impl<T, S> UnwindSafe for Guard<T, S> where
<S as InnerStrategy<T>>::Protected: UnwindSafe,
<S as InnerStrategy<T>>::Protected: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T, A> DynAccess<T> for A where
A: Access<T>,
<A as Access<T>>::Guard: 'static,
[src]
impl<T, A> DynAccess<T> for A where
A: Access<T>,
<A as Access<T>>::Guard: 'static,
[src]pub fn load(&Self) -> DynGuard<T>
[src]
pub fn load(&Self) -> DynGuard<T>
[src]The equivalent of Access::load
.