# Enum std::thread::LocalKeyState [−] [src]

    pub enum LocalKeyState {
        Uninitialized,
        Valid,
        Destroyed,
    }

🔬 This is a nightly-only experimental API. (`thread_local_state` #27716)

state querying was recently added

Indicator of the state of a thread local storage key.

## Variants

`Uninitialized`
🔬 This is a nightly-only experimental API. (`thread_local_state` #27716)

state querying was recently added

All keys are in this state whenever a thread starts. Keys will transition to the `Valid` state once the first call to `with` happens and the initialization expression succeeds.

Keys in the `Uninitialized` state will yield a reference to the closure passed to `with` so long as the initialization routine does not panic.

`Valid`
🔬 This is a nightly-only experimental API. (`thread_local_state` #27716)

state querying was recently added

Once a key has been accessed successfully, it will enter the `Valid` state. Keys in the `Valid` state will remain so until the thread exits, at which point the destructor will be run and the key will enter the `Destroyed` state.

Keys in the `Valid` state will be guaranteed to yield a reference to the closure passed to `with`.

`Destroyed`
🔬 This is a nightly-only experimental API. (`thread_local_state` #27716)

state querying was recently added

When a thread exits, the destructors for keys will be run (if necessary). While a destructor is running, and possibly after a destructor has run, a key is in the `Destroyed` state.

Keys in the `Destroyed` states will trigger a panic when accessed via `with`.

## Trait Implementations

### `impl Debug for LocalKeyState`
[src]

#### `fn fmt(&self, __arg_0: &mut Formatter) -> Result`
[src]

Formats the value using the given formatter.

### `impl Eq for LocalKeyState`
[src]

### `impl PartialEq for LocalKeyState`
[src]

#### `fn eq(&self, __arg_0: &LocalKeyState) -> bool`
[src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `fn ne(&self, other: &Rhs) -> bool`
1.0.0
[src]

This method tests for `!=`.

### `impl Copy for LocalKeyState`
[src]

### `impl Clone for LocalKeyState`
[src]

#### `fn clone(&self) -> LocalKeyState`
[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`
1.0.0
[src]

Performs copy-assignment from `source`. Read more

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)