Struct ListPool
pub struct ListPool<T>where
T: EntityRef + ReservedValue,{ /* private fields */ }
Expand description
A memory pool for storing lists of T
.
Implementations§
§impl<T> ListPool<T>where
T: EntityRef + ReservedValue,
impl<T> ListPool<T>where
T: EntityRef + ReservedValue,
pub fn with_capacity(len: usize) -> ListPool<T>
pub fn with_capacity(len: usize) -> ListPool<T>
Create a new list pool with the given capacity for data pre-allocated.
pub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Get the capacity of this pool. This will be somewhat higher than the total length of lists that can be stored without reallocating, because of internal metadata overheads. It is mostly useful to allow another pool to be allocated that is likely to hold data transferred from this one without the need to grow.
pub fn clear(&mut self)
pub fn clear(&mut self)
Clear the pool, forgetting about all lists that use it.
This invalidates any existing entity lists that used this pool to allocate memory.
The pool’s memory is not released to the operating system, but kept around for faster allocation in the future.
Trait Implementations§
§impl<T> Default for ListPool<T>where
T: EntityRef + ReservedValue,
impl<T> Default for ListPool<T>where
T: EntityRef + ReservedValue,
§impl<'de, T> Deserialize<'de> for ListPool<T>
impl<'de, T> Deserialize<'de> for ListPool<T>
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ListPool<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ListPool<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<T> PartialEq for ListPool<T>where
T: EntityRef + ReservedValue,
impl<T> PartialEq for ListPool<T>where
T: EntityRef + ReservedValue,
§impl<T> Serialize for ListPool<T>
impl<T> Serialize for ListPool<T>
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl<T> Freeze for ListPool<T>
impl<T> RefUnwindSafe for ListPool<T>where
T: RefUnwindSafe,
impl<T> Send for ListPool<T>where
T: Send,
impl<T> Sync for ListPool<T>where
T: Sync,
impl<T> Unpin for ListPool<T>where
T: Unpin,
impl<T> UnwindSafe for ListPool<T>where
T: UnwindSafe,
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
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)