pub enum Message<T, Data: Buf = Bytes> {
Header(T),
Payload(PayloadItem<Data>),
}
Expand description
Represents a HTTP message that can either be a header or payload.
This enum is used to handle both request and response messages in the HTTP protocol.
The generic parameter T
typically represents the header type (request or response header),
while Data
represents the type of the payload data (defaults to Bytes
).
Variants§
Header(T)
Contains the header information of type T
Payload(PayloadItem<Data>)
Contains a chunk of payload data or EOF marker
Implementations§
Source§impl<T> Message<T>
impl<T> Message<T>
Sourcepub fn is_payload(&self) -> bool
pub fn is_payload(&self) -> bool
Returns true if this message contains payload data
Sourcepub fn into_payload_item(self) -> Option<PayloadItem>
pub fn into_payload_item(self) -> Option<PayloadItem>
Converts the message into a PayloadItem if it contains payload data
Returns None if the message contains header information
Trait Implementations§
Source§impl<D: Buf> Encoder<Message<(Response<()>, PayloadSize), D>> for ResponseEncoder
impl<D: Buf> Encoder<Message<(Response<()>, PayloadSize), D>> for ResponseEncoder
Source§fn encode(
&mut self,
item: Message<(ResponseHead, PayloadSize), D>,
dst: &mut BytesMut,
) -> Result<(), Self::Error>
fn encode( &mut self, item: Message<(ResponseHead, PayloadSize), D>, dst: &mut BytesMut, ) -> Result<(), Self::Error>
Auto Trait Implementations§
impl<T, Data> Freeze for Message<T, Data>
impl<T, Data> RefUnwindSafe for Message<T, Data>where
T: RefUnwindSafe,
Data: RefUnwindSafe,
impl<T, Data> Send for Message<T, Data>
impl<T, Data> Sync for Message<T, Data>
impl<T, Data> Unpin for Message<T, Data>
impl<T, Data> UnwindSafe for Message<T, Data>where
T: UnwindSafe,
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