Struct OwnedWriteHalf
struct OwnedWriteHalf { ... }
Owned write half of a UnixStream, created by into_split.
Note that in the AsyncWrite implementation of this type,
poll_shutdown will shut down the stream in the write direction.
Dropping the write half will also shut down the write half of the stream.
Writing to an OwnedWriteHalf is usually done using the convenience methods
found on the AsyncWriteExt trait.
Implementations
impl OwnedWriteHalf
fn reunite(self: Self, other: OwnedReadHalf) -> Result<UnixStream, ReuniteError>Attempts to put the two halves of a
UnixStreamback together and recover the original socket. Succeeds only if the two halves originated from the same call tointo_split.fn forget(self: Self)Destroys the write half, but don't close the write half of the stream until the read half is dropped. If the read half has already been dropped, this closes the stream.
async fn ready(self: &Self, interest: Interest) -> Result<Ready>Waits for any of the requested ready states.
This function is usually paired with
try_write(). It can be used instead ofwritable()to check the returned ready set forReady::WRITABLEandReady::WRITE_CLOSEDevents.The function may complete without the socket being ready. This is a false-positive and attempting an operation will return with
io::ErrorKind::WouldBlock. The function can also return with an emptyReadyset, so you should always check the returned value and possibly wait again if the requested states are not set.This function is equivalent to
UnixStream::ready.Cancel safety
This method is cancel safe. Once a readiness event occurs, the method will continue to return immediately until the readiness event is consumed by an attempt to read or write that fails with
WouldBlockorPoll::Pending.async fn writable(self: &Self) -> Result<()>Waits for the socket to become writable.
This function is equivalent to
ready(Interest::WRITABLE)and is usually paired withtry_write().Cancel safety
This method is cancel safe. Once a readiness event occurs, the method will continue to return immediately until the readiness event is consumed by an attempt to write that fails with
WouldBlockorPoll::Pending.fn try_write(self: &Self, buf: &[u8]) -> Result<usize>Tries to write a buffer to the stream, returning how many bytes were written.
The function will attempt to write the entire contents of
buf, but only part of the buffer may be written.This function is usually paired with
writable().Return
If data is successfully written,
Ok(n)is returned, wherenis the number of bytes written. If the stream is not ready to write data,Err(io::ErrorKind::WouldBlock)is returned.fn try_write_vectored(self: &Self, buf: &[IoSlice<'_>]) -> Result<usize>Tries to write several buffers to the stream, returning how many bytes were written.
Data is written from each buffer in order, with the final buffer read from possible being only partially consumed. This method behaves equivalently to a single call to
try_write()with concatenated buffers.This function is usually paired with
writable().Return
If data is successfully written,
Ok(n)is returned, wherenis the number of bytes written. If the stream is not ready to write data,Err(io::ErrorKind::WouldBlock)is returned.fn peer_addr(self: &Self) -> Result<SocketAddr>Returns the socket address of the remote half of this connection.
fn local_addr(self: &Self) -> Result<SocketAddr>Returns the socket address of the local half of this connection.
impl AsRef for OwnedWriteHalf
fn as_ref(self: &Self) -> &UnixStream
impl AsyncWrite for OwnedWriteHalf
fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll<Result<usize>>fn poll_write_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>]) -> Poll<Result<usize>>fn is_write_vectored(self: &Self) -> boolfn poll_flush(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<()>>fn poll_shutdown(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<()>>
impl Debug for OwnedWriteHalf
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Drop for OwnedWriteHalf
fn drop(self: &mut Self)
impl Freeze for OwnedWriteHalf
impl RefUnwindSafe for OwnedWriteHalf
impl Send for OwnedWriteHalf
impl Sync for OwnedWriteHalf
impl Unpin for OwnedWriteHalf
impl UnsafeUnpin for OwnedWriteHalf
impl UnwindSafe for OwnedWriteHalf
impl<T> Any for OwnedWriteHalf
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for OwnedWriteHalf
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for OwnedWriteHalf
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for OwnedWriteHalf
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for OwnedWriteHalf
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for OwnedWriteHalf
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for OwnedWriteHalf
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>