pub struct WriteHalf(/* private fields */);
Methods from Deref<Target = SendStream>§
Sourcepub async fn write(&mut self, buf: &[u8]) -> Result<usize, WriteError>
pub async fn write(&mut self, buf: &[u8]) -> Result<usize, WriteError>
Write bytes to the stream
Yields the number of bytes written on success. Congestion and flow control may cause this to
be shorter than buf.len()
, indicating that only a prefix of buf
was written.
Sourcepub async fn write_all(&mut self, buf: &[u8]) -> Result<(), WriteError>
pub async fn write_all(&mut self, buf: &[u8]) -> Result<(), WriteError>
Convenience method to write an entire buffer to the stream
Sourcepub async fn write_chunks(
&mut self,
bufs: &mut [Bytes],
) -> Result<Written, WriteError>
pub async fn write_chunks( &mut self, bufs: &mut [Bytes], ) -> Result<Written, WriteError>
Write chunks to the stream
Yields the number of bytes and chunks written on success.
Congestion and flow control may cause this to be shorter than buf.len()
,
indicating that only a prefix of bufs
was written
Sourcepub async fn write_chunk(&mut self, buf: Bytes) -> Result<(), WriteError>
pub async fn write_chunk(&mut self, buf: Bytes) -> Result<(), WriteError>
Convenience method to write a single chunk in its entirety to the stream
Sourcepub async fn write_all_chunks(
&mut self,
bufs: &mut [Bytes],
) -> Result<(), WriteError>
pub async fn write_all_chunks( &mut self, bufs: &mut [Bytes], ) -> Result<(), WriteError>
Convenience method to write an entire list of chunks to the stream
Sourcepub async fn finish(&mut self) -> Result<(), WriteError>
pub async fn finish(&mut self) -> Result<(), WriteError>
Shut down the send stream gracefully.
No new data may be written after calling this method. Completes when the peer has acknowledged all sent data, retransmitting data as needed.
Sourcepub fn reset(&mut self, error_code: VarInt) -> Result<(), UnknownStream>
pub fn reset(&mut self, error_code: VarInt) -> Result<(), UnknownStream>
Close the send stream immediately.
No new data can be written after calling this method. Locally buffered data is dropped, and previously transmitted data will no longer be retransmitted if lost. If an attempt has already been made to finish the stream, the peer may still receive all written data.
Sourcepub fn set_priority(&self, priority: i32) -> Result<(), UnknownStream>
pub fn set_priority(&self, priority: i32) -> Result<(), UnknownStream>
Set the priority of the send stream
Every send stream has an initial priority of 0. Locally buffered data from streams with higher priority will be transmitted before data from streams with lower priority. Changing the priority of a stream with pending data may only take effect after that data has been transmitted. Using many different priority levels per connection may have a negative impact on performance.
Sourcepub fn priority(&self) -> Result<i32, UnknownStream>
pub fn priority(&self) -> Result<i32, UnknownStream>
Get the priority of the send stream
Sourcepub async fn stopped(&mut self) -> Result<VarInt, StoppedError>
pub async fn stopped(&mut self) -> Result<VarInt, StoppedError>
Completes if/when the peer stops the stream, yielding the error code
Trait Implementations§
Source§impl From<SendStream> for WriteHalf
impl From<SendStream> for WriteHalf
Source§fn from(send: SendStream) -> Self
fn from(send: SendStream) -> Self
Source§impl ShutdownSink for WriteHalf
impl ShutdownSink for WriteHalf
fn shutdown_sink(&mut self)
Source§impl Sink<Frame> for WriteHalf
impl Sink<Frame> for WriteHalf
Source§type Error = SeliumError
type Error = SeliumError
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Sink
to receive a value. Read moreSource§fn start_send(self: Pin<&mut Self>, item: Frame) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, item: Frame) -> Result<(), Self::Error>
poll_ready
which returned Poll::Ready(Ok(()))
. Read moreAuto Trait Implementations§
impl Freeze for WriteHalf
impl !RefUnwindSafe for WriteHalf
impl Send for WriteHalf
impl Sync for WriteHalf
impl Unpin for WriteHalf
impl !UnwindSafe for WriteHalf
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, Item> SinkExt<Item> for T
impl<T, Item> SinkExt<Item> for T
Source§fn with<U, Fut, F, E>(self, f: F) -> With<Self, Item, U, Fut, F>
fn with<U, Fut, F, E>(self, f: F) -> With<Self, Item, U, Fut, F>
Source§fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, Item, U, St, F>
fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, Item, U, St, F>
Source§fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F>
fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F>
Source§fn sink_err_into<E>(self) -> SinkErrInto<Self, Item, E>
fn sink_err_into<E>(self) -> SinkErrInto<Self, Item, E>
Into
trait. Read moreSource§fn buffer(self, capacity: usize) -> Buffer<Self, Item>where
Self: Sized,
fn buffer(self, capacity: usize) -> Buffer<Self, Item>where
Self: Sized,
Source§fn flush(&mut self) -> Flush<'_, Self, Item>where
Self: Unpin,
fn flush(&mut self) -> Flush<'_, Self, Item>where
Self: Unpin,
Source§fn send(&mut self, item: Item) -> Send<'_, Self, Item>where
Self: Unpin,
fn send(&mut self, item: Item) -> Send<'_, Self, Item>where
Self: Unpin,
Source§fn feed(&mut self, item: Item) -> Feed<'_, Self, Item>where
Self: Unpin,
fn feed(&mut self, item: Item) -> Feed<'_, Self, Item>where
Self: Unpin,
Source§fn send_all<'a, St>(&'a mut self, stream: &'a mut St) -> SendAll<'a, Self, St>
fn send_all<'a, St>(&'a mut self, stream: &'a mut St) -> SendAll<'a, Self, St>
Source§fn right_sink<Si1>(self) -> Either<Si1, Self>
fn right_sink<Si1>(self) -> Either<Si1, Self>
Source§fn poll_ready_unpin(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>where
Self: Unpin,
fn poll_ready_unpin(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>where
Self: Unpin,
Sink::poll_ready
on Unpin
sink types.Source§fn start_send_unpin(&mut self, item: Item) -> Result<(), Self::Error>where
Self: Unpin,
fn start_send_unpin(&mut self, item: Item) -> Result<(), Self::Error>where
Self: Unpin,
Sink::start_send
on Unpin
sink types.