pub struct ReassemblyPool<const SLOTS: usize, const PAGES: usize> {
pub slots: [Option<Slot>; SLOTS],
/* private fields */
}Expand description
Fixed-capacity reassembly pool.
Fields§
§slots: [Option<Slot>; SLOTS]Implementations§
Source§impl<const SLOTS: usize, const PAGES: usize> ReassemblyPool<SLOTS, PAGES>
impl<const SLOTS: usize, const PAGES: usize> ReassemblyPool<SLOTS, PAGES>
pub fn new() -> Self
Sourcepub fn read_fragment(
&self,
slot_index: usize,
fragment: u8,
out: &mut [u8],
) -> usize
pub fn read_fragment( &self, slot_index: usize, fragment: u8, out: &mut [u8], ) -> usize
Copy a stored fragment into out (which must hold
FRAGMENT_BODY_MAX bytes), returning its length.
pub fn find_slot( &self, stream: &StreamKey, epoch: u16, message_id: u8, ) -> Option<usize>
pub fn open_slot(&mut self, slot: Slot) -> Option<usize>
Sourcepub fn oldest_slot(&self) -> Option<usize>
pub fn oldest_slot(&self) -> Option<usize>
Index of the oldest incomplete slot, for eviction under pressure.
Sourcepub fn close_slot(&mut self, index: usize) -> Option<Slot>
pub fn close_slot(&mut self, index: usize) -> Option<Slot>
Release a slot and all its pages, returning it.
Sourcepub fn drop_stream(&mut self, stream: &StreamKey) -> usize
pub fn drop_stream(&mut self, stream: &StreamKey) -> usize
Drop every slot belonging to stream (after a sequence reset),
returning how many were dropped.
Sourcepub fn insert_fragment(
&mut self,
index: usize,
fragment: u8,
bytes: &[u8],
) -> InsertOutcome
pub fn insert_fragment( &mut self, index: usize, fragment: u8, bytes: &[u8], ) -> InsertOutcome
Store one fragment’s bytes into a slot.