pub struct DecodeStep {
pub consumed: usize,
pub written: usize,
pub finished: bool,
pub needs_input: bool,
}Expand description
A single incremental decode step. Retain input after consumed, and consume
output before calling again. A single coding stages nothing internally; a
chain stages between its codings in buffers allocated at construction.
A step returns for exactly one of three reasons, and says which:
finished | needs_input | stopped because | next |
|---|---|---|---|
true | false | the body is complete | nothing; reset for another body |
false | true | every input byte the decoder can use is used | more input, or end = true |
false | false | output is full (written == output.len()) | drain, then call again |
So a host sizes its scratch buffer from the third case - it filled the buffer - and reads from the transport only in the second. The unconsumed tail of the input in the second case is a partial header or trailer the decoder cannot use yet; keep it and append to it.
Fields§
§consumed: usize§written: usize§finished: bool§needs_input: boolThe decoder stopped for input, not for output space. See the table.
Trait Implementations§
Auto Trait Implementations§
impl Forget for DecodeStep
impl Freeze for DecodeStep
impl RefUnwindSafe for DecodeStep
impl Send for DecodeStep
impl Sync for DecodeStep
impl Unpin for DecodeStep
impl UnsafeUnpin for DecodeStep
impl UnwindSafe for DecodeStep
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