pub struct Sender { /* private fields */ }
Expand description
A sender half created through Body::channel()
.
Useful when wanting to stream chunks from another thread.
Body Closing
Note that the request body will always be closed normally when the sender is dropped (meaning
that the empty terminating chunk will be sent to the remote). If you desire to close the
connection with an incomplete response (e.g. in the case of an error during asynchronous
processing), call the Sender::abort()
method to abort the body in an abnormal fashion.
Implementations§
source§impl Sender
impl Sender
sourcepub fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
pub fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
Check to see if this Sender
can send more data.
sourcepub async fn send_data(&mut self, chunk: Bytes) -> Result<()>
pub async fn send_data(&mut self, chunk: Bytes) -> Result<()>
Send data on data channel when it is ready.
sourcepub async fn send_trailers(&mut self, trailers: HeaderMap) -> Result<()>
pub async fn send_trailers(&mut self, trailers: HeaderMap) -> Result<()>
Send trailers on trailers channel.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Sender
impl Send for Sender
impl Sync for Sender
impl Unpin for Sender
impl !UnwindSafe for Sender
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