pub struct ThreadGuard<T> { /* private fields */ }
Expand description

Thread guard that only gives access to the contained value on the thread it was created on.

Implementations

Create a new thread guard around value.

The thread guard ensures that access to the value is only allowed from the thread it was created on, and otherwise panics.

The thread guard implements the Send trait even if the contained value does not.

Return a reference to the contained value from the thread guard.

Panics

This function panics if called from a different thread than where the thread guard was created.

Return a mutable reference to the contained value from the thread guard.

Panics

This function panics if called from a different thread than where the thread guard was created.

Return the contained value from the thread guard.

Panics

This function panics if called from a different thread than where the thread guard was created.

Returns true if the current thread owns the value, i.e. it can be accessed safely.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

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.