pub struct Reassembler { /* private fields */ }Expand description
Receiver-side: collect chunks for the same message_id until the
full set arrives, then return the reassembled payload.
Implementations§
Source§impl Reassembler
impl Reassembler
pub fn new() -> Self
Sourcepub fn push(&mut self, chunk: Chunk) -> Result<Option<Vec<u8>>, ChunkError>
pub fn push(&mut self, chunk: Chunk) -> Result<Option<Vec<u8>>, ChunkError>
Feed one chunk. Returns Some(payload) when the message is
complete, None while still waiting for siblings.
pub fn pending_message_count(&self) -> usize
Sourcepub fn gc_expired(&mut self, older_than: Duration) -> usize
pub fn gc_expired(&mut self, older_than: Duration) -> usize
Discard partial reassemblies older than older_than. Returns
the count of entries swept. Call on a low-frequency tick to
keep the reassembler bounded against peers that fall silent
mid-message.
Trait Implementations§
Source§impl Default for Reassembler
impl Default for Reassembler
Source§fn default() -> Reassembler
fn default() -> Reassembler
Returns the “default value” for a type. Read more
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