pub struct BatchStreamMemoryPool { /* private fields */ }Expand description
A pool of fixed-size byte buffers.
Buffers are zeroed when they are created; like the unmanaged blocks of the C# class they are not cleared when they are returned.
Implementations§
Source§impl BatchStreamMemoryPool
impl BatchStreamMemoryPool
Sourcepub const DEFAULT_BUFFER_SIZE: usize = 1024
pub const DEFAULT_BUFFER_SIZE: usize = 1024
The buffer size used when none is specified.
pub fn new( reclaim_immediately: bool, buffer_size: usize, start_timer: Option<BatchStreamPoolStartTimer>, ) -> Self
pub fn buffer_size(&self) -> usize
Methods from Deref<Target = BatchStreamPoolBase<Box<[u8]>, BatchStreamMemoryPoolItems>>§
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 Deref for BatchStreamMemoryPool
impl Deref for BatchStreamMemoryPool
Auto Trait Implementations§
impl !Freeze for BatchStreamMemoryPool
impl !RefUnwindSafe for BatchStreamMemoryPool
impl !UnwindSafe for BatchStreamMemoryPool
impl Send for BatchStreamMemoryPool
impl Sync for BatchStreamMemoryPool
impl Unpin for BatchStreamMemoryPool
impl UnsafeUnpin for BatchStreamMemoryPool
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more