Struct execution_context::FlowLocal[][src]

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

A key for flow-local data stored in the execution context.

This type is generated by the flow_local! macro and performs very similarly to the thread_local! macro and std::thread::FlowLocal types. Data associated with a FlowLocal<T> is stored inside the current execution context and the data is destroyed when the execution context is destroyed.

Flow-local data can migrate between threads and hence requires a Send bound. Additionally, flow-local data also requires the 'static bound to ensure it lives long enough. When a key is accessed for the first time the flow's data is initialized with the provided initialization expression to the macro.


impl<T: Send + 'static> FlowLocal<T>

Access this flow-local.

This function will access this flow-local key to retrieve the data associated with the current flow and this key. If this is the first time this key has been accessed on this flow, then the key will be initialized with the initialization expression provided at the time the flow_local! macro was called.

Sets a new value for the flow-local.

Trait Implementations

impl<T> Debug for FlowLocal<T>

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<T> Send for FlowLocal<T>

impl<T> Sync for FlowLocal<T>