pub(super) struct DynamicResourcePool<Handle: Key, Desc: Debug, Res> {
state: RwLock<DynamicResourcePoolProtectedState<Handle, Desc, Res>>,
current_frame_index: u64,
total_resource_size_in_bytes: AtomicU64,
}
Expand description
Generic resource pool for all resources that have varying contents beyond their description.
Unlike in super::static_resource_pool::StaticResourcePool
, a resource can not be uniquely
identified by its description, as the same description can apply to several different resources.
Fields§
§state: RwLock<DynamicResourcePoolProtectedState<Handle, Desc, Res>>
§current_frame_index: u64
§total_resource_size_in_bytes: AtomicU64
Implementations§
source§impl<Handle, Desc, Res> DynamicResourcePool<Handle, Desc, Res>
impl<Handle, Desc, Res> DynamicResourcePool<Handle, Desc, Res>
pub fn alloc<F: FnOnce(&Desc) -> Res>( &self, desc: &Desc, creation_func: F ) -> Arc<DynamicResource<Handle, Desc, Res>>
pub fn get_from_handle( &self, handle: Handle ) -> Result<Arc<DynamicResource<Handle, Desc, Res>>, PoolError>
pub fn begin_frame( &mut self, frame_index: u64, on_destroy_resource: impl FnMut(&Res) )
pub fn num_resources(&self) -> usize
pub fn total_resource_size_in_bytes(&self) -> u64
Trait Implementations§
Auto Trait Implementations§
impl<Handle, Desc, Res> !Freeze for DynamicResourcePool<Handle, Desc, Res>
impl<Handle, Desc, Res> !RefUnwindSafe for DynamicResourcePool<Handle, Desc, Res>
impl<Handle, Desc, Res> Send for DynamicResourcePool<Handle, Desc, Res>
impl<Handle, Desc, Res> Sync for DynamicResourcePool<Handle, Desc, Res>
impl<Handle, Desc, Res> Unpin for DynamicResourcePool<Handle, Desc, Res>
impl<Handle, Desc, Res> UnwindSafe for DynamicResourcePool<Handle, Desc, Res>
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>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§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.