Struct generational_box::Owner
source · pub struct Owner<S: AnyStorage + 'static = UnsyncStorage>(/* private fields */);
Expand description
Owner: Handles dropping generational boxes. The owner acts like a runtime lifetime guard. Any states that you create with an owner will be dropped when that owner is dropped.
Implementations§
source§impl<S: AnyStorage> Owner<S>
impl<S: AnyStorage> Owner<S>
sourcepub fn insert<T: 'static>(&self, value: T) -> GenerationalBox<T, S>where
S: Storage<T>,
pub fn insert<T: 'static>(&self, value: T) -> GenerationalBox<T, S>where
S: Storage<T>,
Insert a value into the store. The value will be dropped when the owner is dropped.
sourcepub fn insert_with_caller<T: 'static>(
&self,
value: T,
caller: &'static Location<'static>
) -> GenerationalBox<T, S>where
S: Storage<T>,
pub fn insert_with_caller<T: 'static>(
&self,
value: T,
caller: &'static Location<'static>
) -> GenerationalBox<T, S>where
S: Storage<T>,
Insert a value into the store with a specific location blamed for creating the value. The value will be dropped when the owner is dropped.
sourcepub fn invalid<T: 'static>(&self) -> GenerationalBox<T, S>
pub fn invalid<T: 'static>(&self) -> GenerationalBox<T, S>
Creates an invalid handle. This is useful for creating a handle that will be filled in later. If you use this before the value is filled in, you will get may get a panic or an out of date value.
Trait Implementations§
source§impl<S: AnyStorage> Clone for Owner<S>
impl<S: AnyStorage> Clone for Owner<S>
Auto Trait Implementations§
impl<S> Freeze for Owner<S>where
S: Default,
impl<S = UnsyncStorage> !RefUnwindSafe for Owner<S>
impl<S> Send for Owner<S>
impl<S> Sync for Owner<S>
impl<S> Unpin for Owner<S>where
S: Default,
impl<S = UnsyncStorage> !UnwindSafe for Owner<S>
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