pub struct WriteHalf { /* private fields */ }Expand description
The writing end of one side. Dropping it without WriteHalf::finish
resets the direction, as a dropped socket would.
Implementations§
Source§impl WriteHalf
impl WriteHalf
pub fn id(&self) -> StreamId
Sourcepub fn try_write(&self, buf: &[u8]) -> Result<usize>
pub fn try_write(&self, buf: &[u8]) -> Result<usize>
Write what fits now; Error::WouldBlock when the ring is full.
Sourcepub fn try_write_exact(&self, buf: &[u8]) -> Result<()>
pub fn try_write_exact(&self, buf: &[u8]) -> Result<()>
Write the complete buffer atomically. When it does not all fit,
returns Error::WouldBlock without publishing a prefix.
Sourcepub fn blocking_write(&self, buf: &[u8]) -> Result<usize>
pub fn blocking_write(&self, buf: &[u8]) -> Result<usize>
Park until something fits, then write it. Blocks the thread.
Sourcepub fn blocking_write_all(&self, buf: &[u8]) -> Result<()>
pub fn blocking_write_all(&self, buf: &[u8]) -> Result<()>
Write everything, waiting as needed. A failure part-way has already committed a prefix; nothing is replayed.
Sourcepub fn finish(&mut self) -> Result<()>
pub fn finish(&mut self) -> Result<()>
No more bytes from this side (FIN); what is buffered still reaches
the reader, then it sees a clean end. The other direction is
unaffected. AsyncWriteExt::shutdown does the same.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Abandon the direction: the reader gets an error and buffered bytes are discarded.
Sourcepub fn wait_writable_timeout(&self, timeout: Duration) -> Result<bool>
pub fn wait_writable_timeout(&self, timeout: Duration) -> Result<bool>
The same wait, bounded: false is the timeout and nothing else,
which is how a caller with a deadline of its own gives up without
giving up its stream.
Sourcepub fn wait_writable(&self) -> Result<()>
pub fn wait_writable(&self) -> Result<()>
Park until a write would make progress or the direction ended.
Sourcepub fn wait_writable_exact(&self, needed: usize) -> Result<()>
pub fn wait_writable_exact(&self, needed: usize) -> Result<()>
Park until an atomic write of needed bytes can be attempted.