Struct arc_swap::Lease [−][src]
pub struct Lease<T: RefCnt> { /* fields omitted */ }
A temporary storage of the pointer.
This, unlike Guard, does not block any write operations and is usually
faster than loading the full Arc. However, this holds only if each thread keeps only small
number of Leases around and if too many are held, the following ones will just fall back to
creating the Arc internally.
Methods
impl<T: RefCnt> Lease<T>[src]
impl<T: RefCnt> Lease<T>pub fn upgrade(guard: &Self) -> T[src]
pub fn upgrade(guard: &Self) -> TLoads a full Arc from the lease.
pub fn into_upgrade(lease: Self) -> T[src]
pub fn into_upgrade(lease: Self) -> TA consuming version of upgrade.
This is a bit faster in certain situations, but consumes the lease.
pub fn get_ref(lease: &Self) -> Option<&T::Base>[src]
pub fn get_ref(lease: &Self) -> Option<&T::Base>Returns access to the data held.
This returns Option even when it can't hold NULL internally, to keep the interface the
same. But there's also the Deref trait for the non-NULL cases, which is usually more
comfortable.
pub fn is_null(lease: &Self) -> bool[src]
pub fn is_null(lease: &Self) -> boolChecks if it contains a null pointer.
Note that for non-NULL T, this always returns false.
Trait Implementations
impl<'a, T: RefCnt> AsRaw<T::Base> for &'a Lease<T>[src]
impl<'a, T: RefCnt> AsRaw<T::Base> for &'a Lease<T>impl<T: RefCnt> AsRaw<T::Base> for Lease<T>[src]
impl<T: RefCnt> AsRaw<T::Base> for Lease<T>impl<T: NonNull> Deref for Lease<T>[src]
impl<T: NonNull> Deref for Lease<T>type Target = T::Base
The resulting type after dereferencing.
fn deref(&self) -> &T::Base[src]
fn deref(&self) -> &T::BaseDereferences the value.
impl<T> Debug for Lease<T> where
T: RefCnt,
T::Base: Debug, [src]
impl<T> Debug for Lease<T> where
T: RefCnt,
T::Base: Debug, fn fmt(&self, formatter: &mut Formatter) -> FmtResult[src]
fn fmt(&self, formatter: &mut Formatter) -> FmtResultFormats the value using the given formatter. Read more
impl<T> Display for Lease<T> where
T: NonNull,
T::Base: Display, [src]
impl<T> Display for Lease<T> where
T: NonNull,
T::Base: Display, fn fmt(&self, formatter: &mut Formatter) -> FmtResult[src]
fn fmt(&self, formatter: &mut Formatter) -> FmtResultFormats the value using the given formatter. Read more
impl<T: RefCnt> Drop for Lease<T>[src]
impl<T: RefCnt> Drop for Lease<T>