pub struct Owner<S = UnsyncStorage>(/* private fields */)
where
S: AnyStorage + 'static;
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> Owner<S>where
S: AnyStorage,
impl<S> Owner<S>where
S: AnyStorage,
sourcepub fn insert<T>(&self, value: T) -> GenerationalBox<T, S>where
T: 'static,
S: Storage<T>,
pub fn insert<T>(&self, value: T) -> GenerationalBox<T, S>where
T: 'static,
S: Storage<T>,
Insert a value into the store. The value will be dropped when the owner is dropped.
sourcepub fn insert_rc<T>(&self, value: T) -> GenerationalBox<T, S>where
T: 'static,
S: Storage<T>,
pub fn insert_rc<T>(&self, value: T) -> GenerationalBox<T, S>where
T: 'static,
S: Storage<T>,
Create a new reference counted box. The box will be dropped when all references are dropped.
sourcepub fn insert_rc_with_caller<T>(
&self,
value: T,
caller: &'static Location<'static>,
) -> GenerationalBox<T, S>where
T: 'static,
S: Storage<T>,
pub fn insert_rc_with_caller<T>(
&self,
value: T,
caller: &'static Location<'static>,
) -> GenerationalBox<T, S>where
T: 'static,
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 insert_with_caller<T>(
&self,
value: T,
caller: &'static Location<'static>,
) -> GenerationalBox<T, S>where
T: 'static,
S: Storage<T>,
pub fn insert_with_caller<T>(
&self,
value: T,
caller: &'static Location<'static>,
) -> GenerationalBox<T, S>where
T: 'static,
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 insert_reference<T>(
&self,
other: GenerationalBox<T, S>,
) -> Result<GenerationalBox<T, S>, BorrowError>where
T: 'static,
S: Storage<T>,
pub fn insert_reference<T>(
&self,
other: GenerationalBox<T, S>,
) -> Result<GenerationalBox<T, S>, BorrowError>where
T: 'static,
S: Storage<T>,
Create a new reference to an existing box. The reference will be dropped when the owner is dropped.
This method may return an error if the other box is no longer valid or it is already borrowed mutably.
Trait Implementations§
source§impl<S> Clone for Owner<S>where
S: AnyStorage,
impl<S> Clone for Owner<S>where
S: AnyStorage,
Auto Trait Implementations§
impl<S> Freeze for Owner<S>
impl<S = UnsyncStorage> !RefUnwindSafe for Owner<S>
impl<S> Send for Owner<S>where
S: Sync,
impl<S> Sync for Owner<S>where
S: Sync,
impl<S> Unpin for Owner<S>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)