pub struct PacketBitmap { /* private fields */ }Expand description
Bitmap tracking received packets within a block.
Reusable: PacketBitmap::reset clears it for another block while keeping
its allocation.
Implementations§
Source§impl PacketBitmap
impl PacketBitmap
Sourcepub fn reset(&mut self, total: usize)
pub fn reset(&mut self, total: usize)
Clear every bit and track total packets, reusing the allocation.
Sourcepub fn grow(&mut self, total: usize)
pub fn grow(&mut self, total: usize)
Grow to track at least total packets, keeping the bits already set.
Sourcepub fn set(&mut self, packet_id: usize) -> bool
pub fn set(&mut self, packet_id: usize) -> bool
Mark a packet index as received. Returns false for an index already
marked or beyond the bitmap.
Sourcepub fn clear(&mut self, packet_id: usize) -> bool
pub fn clear(&mut self, packet_id: usize) -> bool
Unmark a packet index. Returns false for an index not marked.
Sourcepub fn first_n_complete(&self, count: usize) -> bool
pub fn first_n_complete(&self, count: usize) -> bool
Whether the first count indices are all marked received.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check whether the bitmap reports all packets received.
Sourcepub fn missing_ranges(&self) -> Vec<RangeInclusive<u32>>
pub fn missing_ranges(&self) -> Vec<RangeInclusive<u32>>
Return missing packet ranges as inclusive [start, end] indices.
Trait Implementations§
Source§impl Clone for PacketBitmap
impl Clone for PacketBitmap
Source§impl Debug for PacketBitmap
impl Debug for PacketBitmap
Auto Trait Implementations§
impl Freeze for PacketBitmap
impl RefUnwindSafe for PacketBitmap
impl Send for PacketBitmap
impl Sync for PacketBitmap
impl Unpin for PacketBitmap
impl UnsafeUnpin for PacketBitmap
impl UnwindSafe for PacketBitmap
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