pub struct Reassembler { /* private fields */ }Expand description
Tracks incoming fragments and reassembles complete messages.
Each fragment_id is tracked independently.
Once all fragments for a message arrive, Reassembler::add returns Some(data).
Old incomplete messages are evicted when Reassembler::cleanup is called.
Implementations§
Source§impl Reassembler
impl Reassembler
Sourcepub fn with_max_pending(max_pending: usize) -> Self
pub fn with_max_pending(max_pending: usize) -> Self
Create a new reassembler with a custom max pending messages limit.
Sourcepub fn add(&mut self, fragment: Fragment) -> Option<Vec<u8>>
pub fn add(&mut self, fragment: Fragment) -> Option<Vec<u8>>
Add a fragment. Returns Some(data) when all fragments are received.
Returns None if more fragments are still expected.
Silently drops duplicate fragments.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Returns the number of incomplete messages currently being tracked.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Reassembler
impl RefUnwindSafe for Reassembler
impl Send for Reassembler
impl Sync for Reassembler
impl Unpin for Reassembler
impl UnsafeUnpin for Reassembler
impl UnwindSafe for Reassembler
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