Struct thread_local::CachedThreadLocal [−][src]
pub struct CachedThreadLocal<T: Send> { /* fields omitted */ }
Use ThreadLocal
instead
Expand description
Wrapper around ThreadLocal
.
This used to add a fast path for a single thread, however that has been
obsoleted by performance improvements to ThreadLocal
itself.
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.
pub fn iter_mut(&mut self) -> CachedIterMut<'_, T>ⓘNotable traits for CachedIterMut<'a, T>impl<'a, T: Send + 'a> Iterator for CachedIterMut<'a, T> type Item = &'a mut T;
pub fn iter_mut(&mut self) -> CachedIterMut<'_, T>ⓘNotable traits for CachedIterMut<'a, T>impl<'a, T: Send + 'a> Iterator for CachedIterMut<'a, T> type Item = &'a mut T;
impl<'a, T: Send + 'a> Iterator for CachedIterMut<'a, T> type Item = &'a mut T;
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 Item = T
type Item = T
The type of the elements being iterated over.
type IntoIter = CachedIntoIter<T>
type IntoIter = CachedIntoIter<T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> CachedIntoIter<T>ⓘNotable traits for CachedIntoIter<T>impl<T: Send> Iterator for CachedIntoIter<T> type Item = T;
fn into_iter(self) -> CachedIntoIter<T>ⓘNotable traits for CachedIntoIter<T>impl<T: Send> Iterator for CachedIntoIter<T> type Item = T;
impl<T: Send> Iterator for CachedIntoIter<T> type Item = T;
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?
fn into_iter(self) -> CachedIterMut<'a, T>ⓘNotable traits for CachedIterMut<'a, T>impl<'a, T: Send + 'a> Iterator for CachedIterMut<'a, T> type Item = &'a mut T;
fn into_iter(self) -> CachedIterMut<'a, T>ⓘNotable traits for CachedIterMut<'a, T>impl<'a, T: Send + 'a> Iterator for CachedIterMut<'a, T> type Item = &'a mut T;
impl<'a, T: Send + 'a> Iterator for CachedIterMut<'a, T> type Item = &'a mut T;
Creates an iterator from a value. Read more