pub struct BatchStreamObjectPool<T> { /* private fields */ }Expand description
A pool of fixed-size arrays of optional object references.
Implementations§
Source§impl<T> BatchStreamObjectPool<T>
impl<T> BatchStreamObjectPool<T>
Sourcepub const DEFAULT_ARRAY_SIZE: usize = 128
pub const DEFAULT_ARRAY_SIZE: usize = 128
The array size used when none is specified.
pub fn new( reclaim_immediately: bool, array_size: usize, start_timer: Option<BatchStreamPoolStartTimer>, ) -> Self
pub fn array_size(&self) -> usize
Methods from Deref<Target = BatchStreamPoolBase<Box<[Option<T>]>, BatchStreamObjectPoolItems<T>>>§
Sourcepub fn current_usage(&self) -> i32
pub fn current_usage(&self) -> i32
The number of items currently handed out.
Sourcepub fn current_pool(&self) -> i32
pub fn current_pool(&self) -> i32
The number of items currently kept in the pool.
Sourcepub fn timer_is_running(&self) -> bool
pub fn timer_is_running(&self) -> bool
Whether the owner is expected to call
update_timer_tick once per second.
Sourcepub fn update_timer_tick(&self) -> bool
pub fn update_timer_tick(&self) -> bool
The timer procedure: trims the pool down to the number of items that were in use at the same time during the last 10 ticks (but keeps at least 10), and advances the usage statistics.
To be called by the owner once per second while the timer is running. Returns whether the timer keeps running.
Sourcepub fn return_item(&self, item: T)
pub fn return_item(&self, item: T)
Gives an item back (C# Return). The item is cleared, and then kept
for reuse unless the pool is disposed or reclaims immediately.
Trait Implementations§
Source§impl<T> Deref for BatchStreamObjectPool<T>
impl<T> Deref for BatchStreamObjectPool<T>
Auto Trait Implementations§
impl<T> !Freeze for BatchStreamObjectPool<T>
impl<T> !RefUnwindSafe for BatchStreamObjectPool<T>
impl<T> !UnwindSafe for BatchStreamObjectPool<T>
impl<T> Send for BatchStreamObjectPool<T>
impl<T> Sync for BatchStreamObjectPool<T>
impl<T> Unpin for BatchStreamObjectPool<T>
impl<T> UnsafeUnpin for BatchStreamObjectPool<T>
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> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more