Struct s2n_quic_transport::stream::SendStream
source · pub struct SendStream(/* private fields */);
Expand description
A writeable QUIC stream
Implementations§
source§impl SendStream
impl SendStream
pub fn id(&self) -> StreamId
pub fn connection(&self) -> &Connection
pub fn tx_request(&mut self) -> Result<TxRequest<'_, '_>, StreamError>
sourcepub fn poll_send(
&mut self,
chunk: &mut Bytes,
cx: &mut Context<'_>
) -> Poll<Result<(), StreamError>>
pub fn poll_send( &mut self, chunk: &mut Bytes, cx: &mut Context<'_> ) -> Poll<Result<(), StreamError>>
Enqueues a chunk of data for sending it towards the peer.
The method will return:
Poll::Ready(Ok(()))
if the data was enqueued for sending. The providedBytes
will be replaced with an emptyBytes
, in order to reduce needless ref count increases.Poll::Ready(Err(stream_error))
if the data could not be sent, because the stream had previously entered an error state.Poll::Pending
if the send buffer capacity is currently exhausted. In this case, the caller should retry sending after theWaker
on the providedContext
is notified.
sourcepub fn poll_send_vectored(
&mut self,
chunks: &mut [Bytes],
cx: &mut Context<'_>
) -> Poll<Result<usize, StreamError>>
pub fn poll_send_vectored( &mut self, chunks: &mut [Bytes], cx: &mut Context<'_> ) -> Poll<Result<usize, StreamError>>
Enqueues a slice of chunks of data for sending it towards the peer.
The method will return:
Poll::Ready(Ok(count))
if part of the slice was enqueued for sending. Any of the consumedBytes
will be replaced with an emptyBytes
, in order to reduce needless ref count increases. Ifcount
does not equal the total number of chunks, the stream will store the waker and wake the task once more capacity is available.Poll::Ready(Err(stream_error))
if the data could not be sent, because the stream had previously entered an error state.Poll::Pending
if the send buffer capacity is currently exhausted. In this case, the caller should retry sending after theWaker
on the providedContext
is notified.
sourcepub fn poll_send_ready(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<usize, StreamError>>
pub fn poll_send_ready( &mut self, cx: &mut Context<'_> ) -> Poll<Result<usize, StreamError>>
Polls send readiness for the given stream.
The method will return:
Poll::Ready(Ok(available_bytes))
if the stream is ready to send data, whereavailable_bytes
is how many bytes the stream can currently accept.Poll::Ready(Err(stream_error))
if the data could not be sent, because the stream had previously entered an error state.Poll::Pending
if the send buffer capacity is currently exhausted. In this case, the caller should retry sending after theWaker
on the providedContext
is notified.
sourcepub fn send_data(&mut self, chunk: Bytes) -> Result<(), StreamError>
pub fn send_data(&mut self, chunk: Bytes) -> Result<(), StreamError>
Enqueues a chunk of data for sending it towards the peer.
This method should only be called after calling poll_send_ready
first, as the stream
may not have available send buffer capacity.
The method will return:
Ok(())
if the data was enqueued for sending.Err(stream_error)
if the data could not be sent, because the stream had previously entered an error state, or the stream was not ready to send data.
sourcepub fn poll_flush(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(), StreamError>>
pub fn poll_flush( &mut self, cx: &mut Context<'_> ) -> Poll<Result<(), StreamError>>
Flushes the send buffer and waits for acknowledgement from the peer.
The method will return:
Poll::Ready(Ok(()))
if the send buffer was completely flushed and acknowledged.Poll::Ready(Err(stream_error))
if the stream could not be flushed, because the stream had previously entered an error state.Poll::Pending
if the send buffer is still being flushed. In this case, the caller should retry sending after theWaker
on the providedContext
is notified.
sourcepub fn finish(&mut self) -> Result<(), StreamError>
pub fn finish(&mut self) -> Result<(), StreamError>
Marks the stream as finished.
The method will return:
Ok(())
if the stream was finished successfullyErr(stream_error)
if the stream could not be finished, because the stream had previously entered an error state.
sourcepub fn poll_close(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(), StreamError>>
pub fn poll_close( &mut self, cx: &mut Context<'_> ) -> Poll<Result<(), StreamError>>
Marks the stream as finished and waits for all outstanding data to be acknowledged
The method will return:
Poll::Ready(Ok(()))
if the stream was completely flushed and acknowledged.Poll::Ready(Err(stream_error))
if the stream could not be flushed, because the stream had previously entered an error state.Poll::Pending
if the stream is still being flushed. In this case, the caller should retry sending after theWaker
on the providedContext
is notified.
Trait Implementations§
source§impl Debug for SendStream
impl Debug for SendStream
Auto Trait Implementations§
impl Freeze for SendStream
impl !RefUnwindSafe for SendStream
impl Send for SendStream
impl Sync for SendStream
impl Unpin for SendStream
impl !UnwindSafe for SendStream
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