Skip to main content

with_item

Function with_item 

Source
pub fn with_item<T, F, R>(f: F) -> R
where T: Default + 'static, F: FnOnce(&T) -> R,
Expand description

Provides access to a value in the current arbiter’s thread-local storage.

A default value is inserted if the requested type is not already present. The callback holds a reference to that value independently of the storage, so it may replace or remove stored values without invalidating its argument. If the storage has already been destroyed because the thread is exiting, f receives a temporary default value that is not stored.