[][src]Struct perthread::ThreadMap

pub struct ThreadMap<T> { /* fields omitted */ }

This is a structure that lets you define a map with thread local variables, but also gives you access to all them behind a Mutex.

Implementations

impl<T> ThreadMap<T>[src]

pub fn register(&'static self, val: T) -> PerThread<T> where
    T: 'static + Sync
[src]

Register a new per-thread value with the thread map.

pub fn for_each<F>(&self, mut cb: F) where
    F: FnMut(&T), 
[src]

Enumerate the per-thread values

This can't be an iterator because we need to control the lifetime of the returned reference, which is limited to the time we're holding the mutex (which is what's protecting the value from being destroyed while we're using it).

Trait Implementations

impl<T> Default for ThreadMap<T>[src]

impl<T> Send for ThreadMap<T>[src]

impl<T> Sync for ThreadMap<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for ThreadMap<T>[src]

impl<T> Unpin for ThreadMap<T>[src]

impl<T> UnwindSafe for ThreadMap<T>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.