Skip to main content

SkinnedInstancePool

Struct SkinnedInstancePool 

Source
pub struct SkinnedInstancePool { /* private fields */ }
Expand description

Recycles skinned draw slots as skinned instances spawn and despawn.

Implementations§

Source§

impl SkinnedInstancePool

Source

pub fn new() -> Self

An empty pool.

Source

pub fn reserve(&mut self, template: usize, instance: usize)

Record a pre-reserved instance slot as free and owned by template. Called once per expanded copy at load.

Source

pub fn acquire(&mut self, template: usize) -> Option<usize>

Claim a free instance slot for template, or None when the reserve is exhausted (more live copies than were pre-reserved).

Source

pub fn release(&mut self, instance: usize) -> bool

Return a live instance slot to its template’s free list. Returns false if the slot was never a pre-reserved instance (e.g. an authored template slot), so the caller can tell a recyclable slot from a fixed one.

Source

pub fn total_free(&self) -> usize

Total free slots across every template. Surfaced through the debug profile so a probe can watch the pool drain on spawn and refill on despawn, a direct check on the free-list recycle.

Trait Implementations§

Source§

impl Debug for SkinnedInstancePool

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SkinnedInstancePool

Source§

fn default() -> SkinnedInstancePool

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.