Struct thread_local::ThreadLocal [] [src]

pub struct ThreadLocal<T: ?Sized + Send> { /* fields omitted */ }

Thread-local variable wrapper

See the module-level documentation for more.

Methods

impl<T: ?Sized + Send> ThreadLocal<T>
[src]

[src]

Creates a new empty ThreadLocal.

[src]

Returns the element for the current thread, if it exists.

[src]

Returns the element for the current thread, or creates it if it doesn't exist.

[src]

Returns the element for the current thread, or creates it if it doesn't exist. If create fails, that error is returned and no element is added.

[src]

Returns a mutable iterator over the local values of all threads.

Since this call borrows the ThreadLocal mutably, this operation can be done safely---the mutable borrow statically guarantees no other threads are currently accessing their associated values.

[src]

Removes all thread-specific values from the ThreadLocal, effectively reseting it to its original state.

Since this call borrows the ThreadLocal mutably, this operation can be done safely---the mutable borrow statically guarantees no other threads are currently accessing their associated values.

impl<T: Send + Default> ThreadLocal<T>
[src]

[src]

Returns the element for the current thread, or creates a default one if it doesn't exist.

Trait Implementations

impl<T: ?Sized + Send> Sync for ThreadLocal<T>
[src]

impl<T: ?Sized + Send> Default for ThreadLocal<T>
[src]

[src]

Returns the "default value" for a type. Read more

impl<T: ?Sized + Send> Drop for ThreadLocal<T>
[src]

[src]

Executes the destructor for this type. Read more

impl<T: ?Sized + Send> IntoIterator for ThreadLocal<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

[src]

Creates an iterator from a value. Read more

impl<'a, T: ?Sized + Send + 'a> IntoIterator for &'a mut ThreadLocal<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

[src]

Creates an iterator from a value. Read more

impl<T: ?Sized + Send + Debug> Debug for ThreadLocal<T>
[src]

[src]

Formats the value using the given formatter.

impl<T: ?Sized + Send + UnwindSafe> UnwindSafe for ThreadLocal<T>
[src]