pub struct SegmentReassembler { /* private fields */ }Expand description
Reassembles segmented PVA messages.
Sans-io: the caller reads a header and payload off the wire and pushes them in. One instance per connection, because a message’s segments may be separated by control frames that the caller handles in between.
Implementations§
Source§impl SegmentReassembler
impl SegmentReassembler
Sourcepub fn new() -> SegmentReassembler
pub fn new() -> SegmentReassembler
A reassembler with the DEFAULT_MAX_MESSAGE_BYTES cap.
Sourcepub fn with_max_bytes(max_bytes: usize) -> SegmentReassembler
pub fn with_max_bytes(max_bytes: usize) -> SegmentReassembler
A reassembler with a custom cap on the reassembled message size.
Sourcepub fn pending_bytes(&self) -> usize
pub fn pending_bytes(&self) -> usize
Bytes of payload currently held for an in-progress message.
Sourcepub fn push(
&mut self,
header: [u8; 8],
payload: Vec<u8>,
) -> Result<SegmentOutcome, DecodeError>
pub fn push( &mut self, header: [u8; 8], payload: Vec<u8>, ) -> Result<SegmentOutcome, DecodeError>
Feed one frame. See SegmentOutcome.
On any Err the in-progress message is discarded and the reassembler
is ready for the next one; the caller decides whether to keep the
connection.
Trait Implementations§
Source§impl Default for SegmentReassembler
impl Default for SegmentReassembler
Source§fn default() -> SegmentReassembler
fn default() -> SegmentReassembler
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SegmentReassembler
impl RefUnwindSafe for SegmentReassembler
impl Send for SegmentReassembler
impl Sync for SegmentReassembler
impl Unpin for SegmentReassembler
impl UnsafeUnpin for SegmentReassembler
impl UnwindSafe for SegmentReassembler
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