pub struct Reassembler { /* private fields */ }Expand description
Reassembles fragmented mesh payloads.
Call Reassembler::insert for each received FragmentFrame. When the
last required fragment arrives the complete packet is returned. Call
Reassembler::expire_stale periodically (e.g. once per second) to free
memory for timed-out incomplete buffers.
Implementations§
Source§impl Reassembler
impl Reassembler
Sourcepub fn with_timeout(timeout: Duration) -> Self
pub fn with_timeout(timeout: Duration) -> Self
Create a reassembler with a custom timeout (useful in tests).
Sourcepub fn insert(&mut self, frame: FragmentFrame) -> Option<Vec<u8>>
pub fn insert(&mut self, frame: FragmentFrame) -> Option<Vec<u8>>
Feed a FragmentFrame to the reassembler.
Returns Some(packet) when the complete packet is ready, otherwise
None. Duplicate fragments are silently ignored.
Sourcepub fn expire_stale(&mut self)
pub fn expire_stale(&mut self)
Discard all reassembly buffers that have been waiting longer than the configured timeout.
Sourcepub fn buffer_count(&self) -> usize
pub fn buffer_count(&self) -> usize
Number of in-progress reassembly buffers currently held.
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