pub enum PayloadItem<Data: Buf = Bytes> {
Chunk(Data),
Eof,
}
Expand description
Represents an item in the HTTP message payload stream.
This enum is used by the payload decoder to produce either data chunks or signal the end of the payload stream (EOF).
Variants§
Implementations§
Source§impl<D: Buf> PayloadItem<D>
impl<D: Buf> PayloadItem<D>
Source§impl PayloadItem
impl PayloadItem
Sourcepub fn as_bytes(&self) -> Option<&Bytes>
pub fn as_bytes(&self) -> Option<&Bytes>
Returns a reference to the contained bytes if this is a Chunk
Returns None if this is an EOF marker
Sourcepub fn as_mut_bytes(&mut self) -> Option<&mut Bytes>
pub fn as_mut_bytes(&mut self) -> Option<&mut Bytes>
Returns a mutable reference to the contained bytes if this is a Chunk
Returns None if this is an EOF marker
Sourcepub fn into_bytes(self) -> Option<Bytes>
pub fn into_bytes(self) -> Option<Bytes>
Consumes the PayloadItem and returns the contained bytes if this is a Chunk
Returns None if this is an EOF marker
Trait Implementations§
Source§impl<Data: Clone + Buf> Clone for PayloadItem<Data>
impl<Data: Clone + Buf> Clone for PayloadItem<Data>
Source§fn clone(&self) -> PayloadItem<Data>
fn clone(&self) -> PayloadItem<Data>
Returns a copy 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 moreimpl<Data: Eq + Buf> Eq for PayloadItem<Data>
impl<Data: Buf> StructuralPartialEq for PayloadItem<Data>
Auto Trait Implementations§
impl<Data> Freeze for PayloadItem<Data>where
Data: Freeze,
impl<Data> RefUnwindSafe for PayloadItem<Data>where
Data: RefUnwindSafe,
impl<Data> Send for PayloadItem<Data>where
Data: Send,
impl<Data> Sync for PayloadItem<Data>where
Data: Sync,
impl<Data> Unpin for PayloadItem<Data>where
Data: Unpin,
impl<Data> UnwindSafe for PayloadItem<Data>where
Data: UnwindSafe,
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