pub enum Payload {
None,
H1(Payload),
H2(Payload),
Stream(PayloadStream),
}Expand description
An HTTP request payload.
Variants§
None
No payload is available.
H1(Payload)
An HTTP/1 payload stream.
H2(Payload)
An HTTP/2 payload stream.
Stream(PayloadStream)
A custom payload stream.
Implementations§
Source§impl Payload
impl Payload
Sourcepub fn take(&mut self) -> Self
pub fn take(&mut self) -> Self
Takes the payload and replaces it with Payload::None.
Sourcepub fn from_stream<S>(stream: S) -> Self
pub fn from_stream<S>(stream: S) -> Self
Creates a payload from a local asynchronous byte stream.
The stream is pinned and does not need to implement Unpin. It must
yield HTTP PayloadError values directly.
Sourcepub async fn recv(&mut self) -> Option<Result<Bytes, PayloadError>>
pub async fn recv(&mut self) -> Option<Result<Bytes, PayloadError>>
Waits for and returns the next payload chunk.
Trait Implementations§
Source§impl From<Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>>>>> for Payload
impl From<Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>>>>> for Payload
Source§fn from(pl: PayloadStream) -> Self
fn from(pl: PayloadStream) -> Self
Converts to this type from the input type.
Source§impl From<Receiver<PayloadError>> for Payload
impl From<Receiver<PayloadError>> for Payload
Source§fn from(v: Receiver<PayloadError>) -> Self
fn from(v: Receiver<PayloadError>) -> Self
Converts to this type from the input type.
Source§impl Stream for Payload
impl Stream for Payload
Auto Trait Implementations§
impl !RefUnwindSafe for Payload
impl !Send for Payload
impl !Sync for Payload
impl !UnwindSafe for Payload
impl Freeze for Payload
impl Unpin for Payload
impl UnsafeUnpin for Payload
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