Struct arc_swap::Guard

source ·
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§

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.

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§

Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

A guard object containing the value and keeping it alive. Read more
The loading method. Read more
Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
The equivalent of Access::load.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.