pub struct Sender {
want_rx: Receiver,
data_tx: Sender<Result<Bytes, Error>>,
trailers_tx: Option<Sender<HeaderMap>>,
}
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.
Fields§
§want_rx: Receiver
§data_tx: Sender<Result<Bytes, Error>>
§trailers_tx: Option<Sender<HeaderMap>>
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.
fn poll_want(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
async fn ready(&mut self) -> Result<()>
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.
pub(crate) fn send_error(&mut self, err: Error)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sender
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