pub struct Interleaver { /* private fields */ }Expand description
Buffers up to depth blocks of datagrams and emits them column-major
so each block’s shards are spaced depth apart on the wire.
Implementations§
Source§impl Interleaver
impl Interleaver
Sourcepub fn new(depth: usize) -> Self
pub fn new(depth: usize) -> Self
Create an interleaver of the given depth (clamped to at least 1).
Sourcepub fn set_depth(&mut self, depth: usize) -> Vec<Vec<u8>>
pub fn set_depth(&mut self, depth: usize) -> Vec<Vec<u8>>
Change the interleave depth. Any buffered blocks are flushed first (returned to the caller) so the depth change does not reorder a partially-staged group.
Sourcepub fn buffered_blocks(&self) -> usize
pub fn buffered_blocks(&self) -> usize
Number of blocks currently buffered.
Sourcepub fn add_block(&mut self, datagrams: Vec<Vec<u8>>) -> Vec<Vec<u8>>
pub fn add_block(&mut self, datagrams: Vec<Vec<u8>>) -> Vec<Vec<u8>>
Stage one block’s datagrams. Returns the interleaved datagrams
ready to transmit: empty until depth blocks are buffered, then
the whole interleaved group. At depth 1 the block is returned
immediately (pass-through, no added latency).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Interleaver
impl RefUnwindSafe for Interleaver
impl Send for Interleaver
impl Sync for Interleaver
impl Unpin for Interleaver
impl UnsafeUnpin for Interleaver
impl UnwindSafe for Interleaver
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