Trait RegionLocalCopyExt

Source
pub trait RegionLocalCopyExt<T>
where T: Copy,
{ // Required method fn get_local(&self) -> T; }
Expand description

Extension trait that adds convenience methods to region-local static variables in a region_local! block, specifically for Copy types.

Required Methods§

Source

fn get_local(&self) -> T

Gets a copy of the value from the current memory region.

§Example
use region_local::{region_local, RegionLocalCopyExt};

region_local!(static CURRENT_ACCESS_TOKEN: u128 = 0x123100);

let token = CURRENT_ACCESS_TOKEN.get_local();
assert_eq!(token, 0x123100);

Implementations on Foreign Types§

Source§

impl<T> RegionLocalCopyExt<T> for StaticInstancePerThread<RegionLocal<T>>
where T: Clone + Copy + Send + Sync + 'static,

Source§

fn get_local(&self) -> T

Implementors§