Struct tokio::net::tcp::OwnedWriteHalf[][src]

pub struct OwnedWriteHalf { /* fields omitted */ }
This is supported on crate feature net only.
Expand description

Owned write half of a TcpStream, created by into_split.

Note that in the AsyncWrite implementation of this type, poll_shutdown will shut down the TCP stream in the write direction. Dropping the write half will also shut down the write half of the TCP stream.

Writing to an OwnedWriteHalf is usually done using the convenience methods found on the AsyncWriteExt trait.

Implementations

Attempts to put the two halves of a TcpStream back together and recover the original socket. Succeeds only if the two halves originated from the same call to into_split.

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.

Waits for any of the requested ready states.

This function is usually paired with try_read() or try_write(). It can be used to concurrently read / write to the same socket on a single task without splitting the socket.

This function is equivalent to TcpStream::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 WouldBlock or Poll::Pending.

Waits for the socket to become writable.

This function is equivalent to ready(Interest::WRITABLE) and is usually paired with try_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 WouldBlock or Poll::Pending.

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, where n is the number of bytes written. If the stream is not ready to write data, Err(io::ErrorKind::WouldBlock) is returned.

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, where n is the number of bytes written. If the stream is not ready to write data, Err(io::ErrorKind::WouldBlock) is returned.

Returns the remote address that this stream is connected to.

Returns the local address that this stream is bound to.

Trait Implementations

Performs the conversion.

Attempt to write bytes from buf into the object. Read more

Like poll_write, except that it writes from a slice of buffers. Read more

Determines if this writer has an efficient poll_write_vectored implementation. Read more

Attempts to flush the object, ensuring that any buffered data reach their destination. Read more

Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.