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

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::<_, DefaultStrategy>::from_inner(Arc::clone(&*g1));

Trait Implementations

Converts the value into a raw pointer.

Converts the value into a raw pointer.

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Formats the value using the given formatter. Read more

Performs the conversion.

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.

Performs the conversion.

Performs the conversion.

Performs the conversion.

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.