pub enum TransferCoding {
Eof,
Corrupted,
Length(u64),
DecodeChunked(ChunkedState, u64),
EncodeChunked,
Upgrade,
}Expand description
Coder for different Transfer-Decoding/Transfer-Encoding.
Variants§
Eof
Default coder indicates the Request/Response have successfully code it’s associated body.
Corrupted
Corrupted coder that can not be used anymore.
Length(u64)
Coder used when a Content-Length header is passed with a positive integer.
DecodeChunked(ChunkedState, u64)
Decoder used when Transfer-Encoding is chunked.
EncodeChunked
Encoder for when Transfer-Encoding includes chunked.
Upgrade
Upgrade type coder that pass through body as is without transforming.
Implementations§
Source§impl TransferCoding
impl TransferCoding
pub const fn eof() -> Self
pub const fn length(len: u64) -> Self
pub const fn decode_chunked() -> Self
pub const fn encode_chunked() -> Self
pub const fn upgrade() -> Self
Sourcepub fn is_eof(&self) -> bool
pub fn is_eof(&self) -> bool
Check if Self is in EOF state. An EOF state means TransferCoding is ended gracefully and can not decode any value. See TransferCoding::decode for detail.
pub fn is_upgrade(&self) -> bool
Source§impl TransferCoding
impl TransferCoding
pub fn try_set(&mut self, other: Self) -> Result<(), ProtoError>
pub fn set_eof(&mut self)
pub fn set_corrupted(&mut self)
Sourcepub fn encode<W>(&mut self, bytes: Bytes, buf: &mut W)where
W: H1BufWrite,
pub fn encode<W>(&mut self, bytes: Bytes, buf: &mut W)where
W: H1BufWrite,
Encode message. Return EOF state of encoder
Sourcepub fn encode_eof<W>(&mut self, buf: &mut W)where
W: H1BufWrite,
pub fn encode_eof<W>(&mut self, buf: &mut W)where
W: H1BufWrite,
Encode eof. Return EOF state of encoder
Sourcepub fn decode(&mut self, src: &mut BytesMut) -> ChunkResult
pub fn decode(&mut self, src: &mut BytesMut) -> ChunkResult
decode body. See ChunkResult for detailed outcome.
Trait Implementations§
Source§impl Clone for TransferCoding
impl Clone for TransferCoding
Source§fn clone(&self) -> TransferCoding
fn clone(&self) -> TransferCoding
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TransferCoding
impl Debug for TransferCoding
Source§impl PartialEq for TransferCoding
impl PartialEq for TransferCoding
impl Eq for TransferCoding
impl StructuralPartialEq for TransferCoding
Auto Trait Implementations§
impl Freeze for TransferCoding
impl RefUnwindSafe for TransferCoding
impl Send for TransferCoding
impl Sync for TransferCoding
impl Unpin for TransferCoding
impl UnwindSafe for TransferCoding
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