pub struct BlockBuilder<T: Copy, const N: usize> { /* private fields */ }Expand description
Privately fills one block and publishes it to the caller only when complete.
A discontinuous sample is rejected without changing the partial block. The
caller can preserve it, or call clear and retry the returned
sample as the start of a new window. This keeps loss policy explicit.
Implementations§
Source§impl<T: Copy, const N: usize> BlockBuilder<T, N>
impl<T: Copy, const N: usize> BlockBuilder<T, N>
Sourcepub fn push(
&mut self,
sequence: u32,
sample: T,
) -> Result<Option<Block<T, N>>, FillError<T>>
pub fn push( &mut self, sequence: u32, sample: T, ) -> Result<Option<Block<T, N>>, FillError<T>>
Append one sequenced sample.
Returns Ok(None) while the block is partial and Ok(Some(block))
exactly when the Nth sample completes it. Completion also resets the
builder, ready for the next block.
Sourcepub const fn len(&self) -> usize
pub const fn len(&self) -> usize
Number of samples currently held in the private partial block.
Sourcepub const fn expected_sequence(&self) -> Option<u32>
pub const fn expected_sequence(&self) -> Option<u32>
Sequence required by the next push, or None when any non-zero
sequence may start a new block.
Trait Implementations§
Auto Trait Implementations§
impl<T, const N: usize> Freeze for BlockBuilder<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for BlockBuilder<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for BlockBuilder<T, N>where
T: Send,
impl<T, const N: usize> Sync for BlockBuilder<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for BlockBuilder<T, N>where
T: Unpin,
impl<T, const N: usize> UnsafeUnpin for BlockBuilder<T, N>where
T: UnsafeUnpin,
impl<T, const N: usize> UnwindSafe for BlockBuilder<T, N>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