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§
§impl<S> Owner<S>where
S: AnyStorage,
impl<S> Owner<S>where
S: AnyStorage,
pub 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.
pub 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.
pub fn invalid<T>(&self) -> GenerationalBox<T, S>where
T: 'static,
pub fn invalid<T>(&self) -> GenerationalBox<T, S>where
T: 'static,
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§
§impl<S> Clone for Owner<S>where
S: AnyStorage,
impl<S> Clone for Owner<S>where
S: AnyStorage,
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.