Struct thread_local::CachedThreadLocal [−][src]
Expand description
Wrapper around ThreadLocal
which adds a fast path for a single thread.
This has the same API as ThreadLocal
, but will register the first thread
that sets a value as its owner. All accesses by the owner will go through
a special fast path which is much faster than the normal ThreadLocal
path.
Implementations
Creates a new empty CachedThreadLocal
.
Returns the element for the current thread, or creates it if it doesn’t exist.
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.
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.
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.
Returns the element for the current thread, or creates a default one if it doesn’t exist.
Trait Implementations
Returns the “default value” for a type. Read more
type IntoIter = CachedIntoIter<T>
type IntoIter = CachedIntoIter<T>
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
type IntoIter = CachedIterMut<'a, T>
type IntoIter = CachedIterMut<'a, T>
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more