pub struct Region<'region, T> { /* private fields */ }Implementations§
Source§impl<'region, T> Region<'region, T>
impl<'region, T> Region<'region, T>
pub fn new() -> Self
Sourcepub fn store(&self, value: T) -> RegionId<'region, T>
pub fn store(&self, value: T) -> RegionId<'region, T>
Panics when allocating more than 2^32 items
Sourcepub fn get<'m>(
&'m self,
id: RegionId<'m, T>,
) -> MutexRef<'m, Vec<T>, T, impl for<'g> Fn(&'g Vec<T>) -> &'g T + 'm>
pub fn get<'m>( &'m self, id: RegionId<'m, T>, ) -> MutexRef<'m, Vec<T>, T, impl for<'g> Fn(&'g Vec<T>) -> &'g T + 'm>
Takes a mutex lock for the life time of MutexRef. To avoid
this cost for every access, use lock instead. May panic on
invalid ids.
Sourcepub fn get_mut<'m>(
&'m self,
id: RegionId<'m, T>,
) -> MutexRefMut<'m, Vec<T>, T, impl for<'g> Fn(&'g mut Vec<T>) -> &'g mut T + 'm>
pub fn get_mut<'m>( &'m self, id: RegionId<'m, T>, ) -> MutexRefMut<'m, Vec<T>, T, impl for<'g> Fn(&'g mut Vec<T>) -> &'g mut T + 'm>
Takes a mutex lock for the life time of MutexRefMut. To avoid
this cost for every access, use lock instead. May panic on
invalid ids.
Sourcepub fn lock<'m>(&'m self) -> RegionGuard<'m, T>
pub fn lock<'m>(&'m self) -> RegionGuard<'m, T>
Lock access to the region for the life time of the
RegionGuard. This makes multiple accesses of existing
entries more efficient.
Trait Implementations§
Auto Trait Implementations§
impl<'region, T> !Freeze for Region<'region, T>
impl<'region, T> RefUnwindSafe for Region<'region, T>where
T: RefUnwindSafe,
impl<'region, T> Send for Region<'region, T>
impl<'region, T> Sync for Region<'region, T>
impl<'region, T> Unpin for Region<'region, T>where
T: Unpin,
impl<'region, T> UnwindSafe for Region<'region, T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more