Struct thread_local::ThreadLocal [] [src]

pub struct ThreadLocal<T: ?Sized> {
    // some fields omitted
}

Thread-local variable wrapper

See the module-level documentation for more.

Methods

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

fn new() -> ThreadLocal<T>

Creates a new empty ThreadLocal.

fn get(&self) -> Option<&T>

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

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.

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

fn get_default(&self) -> &T

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

Trait Implementations

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

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

fn default() -> ThreadLocal<T>

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

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

fn drop(&mut self)

A method called when the value goes out of scope. Read more