pub struct ReadAssembler { /* private fields */ }Expand description
Incremental assembler for one 5522 read: OK (DATA*) DONE.
DATA chunks for one MIME type arrive sequentially, then the next type’s
chunks; each chunk is individually padded base64 of at most 4096 decoded
bytes, so chunks decode independently and decoded bytes concatenate.
A single assembler handles exactly one read and is discarded after
AssembleOutcome::Complete or any error.
Implementations§
Source§impl ReadAssembler
impl ReadAssembler
Sourcepub fn new(expected_id: &str) -> Self
pub fn new(expected_id: &str) -> Self
New assembler capped at MAX_READ_BYTES total decoded bytes.
Sourcepub fn with_max_bytes(expected_id: &str, max_bytes: usize) -> Self
pub fn with_max_bytes(expected_id: &str, max_bytes: usize) -> Self
New assembler with an explicit decoded-bytes cap (tests use a small cap instead of allocating megabytes).
Sourcepub fn push(
&mut self,
packet: &ReadPacket,
) -> Result<AssembleOutcome, AssembleError>
pub fn push( &mut self, packet: &ReadPacket, ) -> Result<AssembleOutcome, AssembleError>
Feed one parsed packet; returns the read outcome.
§Errors
Returns AssembleError on id mismatch, out-of-order packets,
terminal error statuses, oversized data, or invalid base64.
Trait Implementations§
Auto Trait Implementations§
impl Forget for ReadAssembler
impl Freeze for ReadAssembler
impl RefUnwindSafe for ReadAssembler
impl Send for ReadAssembler
impl Sync for ReadAssembler
impl Unpin for ReadAssembler
impl UnsafeUnpin for ReadAssembler
impl UnwindSafe for ReadAssembler
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