pub struct ChunkProducer { /* private fields */ }Expand description
Handle for the processing thread. Pushes chunks using the DROP_OLDEST policy.
Implementations§
Source§impl ChunkProducer
impl ChunkProducer
Sourcepub fn push(&mut self, chunk: AudioChunk) -> Option<u64>
pub fn push(&mut self, chunk: AudioChunk) -> Option<u64>
Push a chunk. If full, discard the oldest chunk (DROP_OLDEST) and count it.
Set dropped_before to the cumulative number of chunks discarded before this chunk
was inserted, including the one evicted to make room for this chunk. Consumers can
find the number dropped since the previous chunk from the difference between
consecutive dropped_before values, and the total from the absolute value.
Return Some(total_dropped) if this push dropped a chunk (for deciding whether to
fire crate::types::Event::ChunkDropped); otherwise return None.
Sourcepub fn dropped_count(&self) -> u64
pub fn dropped_count(&self) -> u64
Cumulative number of chunks discarded by DROP_OLDEST.
Auto Trait Implementations§
impl Freeze for ChunkProducer
impl RefUnwindSafe for ChunkProducer
impl Send for ChunkProducer
impl Sync for ChunkProducer
impl Unpin for ChunkProducer
impl UnsafeUnpin for ChunkProducer
impl UnwindSafe for ChunkProducer
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