[−][src]Struct thread_local::CachedThreadLocal 
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.
Methods
impl<T: ?Sized + Send> CachedThreadLocal<T>[src] 
impl<T: ?Sized + Send> CachedThreadLocal<T>pub fn new() -> CachedThreadLocal<T>[src] 
pub fn new() -> CachedThreadLocal<T>Creates a new empty CachedThreadLocal.
pub fn get(&self) -> Option<&T>[src] 
pub fn get(&self) -> Option<&T>Returns the element for the current thread, if it exists.
ⓘImportant traits for &'a mut Rpub fn get_or<F>(&self, create: F) -> &T where
    F: FnOnce() -> Box<T>, [src] 
pub fn get_or<F>(&self, create: F) -> &T where
    F: FnOnce() -> Box<T>, Returns the element for the current thread, or creates it if it doesn't exist.
pub fn get_or_try<F, E>(&self, create: F) -> Result<&T, E> where
    F: FnOnce() -> Result<Box<T>, E>, [src] 
pub fn get_or_try<F, E>(&self, create: F) -> Result<&T, E> where
    F: FnOnce() -> Result<Box<T>, E>, 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>[src] 
pub fn iter_mut(&mut self) -> CachedIterMut<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.
pub fn clear(&mut self)[src] 
pub fn clear(&mut self)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> CachedThreadLocal<T>[src] 
impl<T: Send + Default> CachedThreadLocal<T>ⓘImportant traits for &'a mut Rpub fn get_default(&self) -> &T[src] 
pub fn get_default(&self) -> &TReturns the element for the current thread, or creates a default one if it doesn't exist.
Trait Implementations
impl<T: ?Sized + Send> Sync for CachedThreadLocal<T>[src] 
impl<T: ?Sized + Send> Sync for CachedThreadLocal<T>impl<T: ?Sized + Send> Default for CachedThreadLocal<T>[src] 
impl<T: ?Sized + Send> Default for CachedThreadLocal<T>fn default() -> CachedThreadLocal<T>[src] 
fn default() -> CachedThreadLocal<T>Returns the "default value" for a type. Read more
impl<T: ?Sized + Send> IntoIterator for CachedThreadLocal<T>[src] 
impl<T: ?Sized + Send> IntoIterator for CachedThreadLocal<T>type Item = Box<T>
The type of the elements being iterated over.
type IntoIter = CachedIntoIter<T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> CachedIntoIter<T>[src] 
fn into_iter(self) -> CachedIntoIter<T>Creates an iterator from a value. Read more
impl<'a, T: ?Sized + Send + 'a> IntoIterator for &'a mut CachedThreadLocal<T>[src] 
impl<'a, T: ?Sized + Send + 'a> IntoIterator for &'a mut CachedThreadLocal<T>type Item = &'a mut Box<T>
The type of the elements being iterated over.
type IntoIter = CachedIterMut<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> CachedIterMut<'a, T>[src] 
fn into_iter(self) -> CachedIterMut<'a, T>Creates an iterator from a value. Read more
impl<T: ?Sized + Send + Debug> Debug for CachedThreadLocal<T>[src] 
impl<T: ?Sized + Send + Debug> Debug for CachedThreadLocal<T>fn fmt(&self, f: &mut Formatter) -> Result[src] 
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<T: ?Sized + Send + UnwindSafe> UnwindSafe for CachedThreadLocal<T>[src] 
impl<T: ?Sized + Send + UnwindSafe> UnwindSafe for CachedThreadLocal<T>Auto Trait Implementations
impl<T: ?Sized> Send for CachedThreadLocal<T>
impl<T: ?Sized> Send for CachedThreadLocal<T>Blanket Implementations
impl<T> From for T[src] 
impl<T> From for Timpl<I> IntoIterator for I where
    I: Iterator, [src] 
impl<I> IntoIterator for I where
    I: Iterator, type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I[src] 
fn into_iter(self) -> ICreates an iterator from a value. Read more
impl<T, U> Into for T where
    U: From<T>, [src] 
impl<T, U> Into for T where
    U: From<T>, impl<T, U> TryFrom for T where
    T: From<U>, [src] 
impl<T, U> TryFrom for T where
    T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src] 
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>try_from)Performs the conversion.
impl<T> Borrow for T where
    T: ?Sized, [src] 
impl<T> Borrow for T where
    T: ?Sized, ⓘImportant traits for &'a mut Rfn borrow(&self) -> &T[src] 
fn borrow(&self) -> &TImmutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
    U: TryFrom<T>, [src] 
impl<T, U> TryInto for T where
    U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src] 
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>try_from)Performs the conversion.
impl<T> BorrowMut for T where
    T: ?Sized, [src] 
impl<T> BorrowMut for T where
    T: ?Sized, ⓘImportant traits for &'a mut Rfn borrow_mut(&mut self) -> &mut T[src] 
fn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more
impl<T> Any for T where
    T: 'static + ?Sized, [src] 
impl<T> Any for T where
    T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src] 
fn get_type_id(&self) -> TypeId🔬 This is a nightly-only experimental API.  (get_type_id)
this method will likely be replaced by an associated static
Gets the TypeId of self. Read more