pub struct TcpStream { /* private fields */ }

Implementations

Wraps std_stream so we can perform async operations on it.

Errors

Returns any Err(std::io::Error) returned by std::net::TcpStream::set_nonblocking.

Opens a TCP connection to addr.

Uses safina_executor::schedule_blocking to perform the blocking connect call. Panics if the caller is not running on an Executor.

Errors

Returns any Err(std::io::Error) returned by std::net::TcpStream::connect.

Reads some bytes from the socket and places them in buf. Returns the number of bytes read.

This is an async version of std::io::Read::read.

Errors

Returns any Err(std::io::Error) returned by std::net::TcpStream::read.

Reads all bytes until the socket is shutdown for reading. Appends the bytes to buf.

This is an async version of std::io::Read::read_to_end.

Errors

Returns any Err(std::io::Error) returned by std::net::TcpStream::read.

Reads all bytes until the socket is shutdown for reading. Interprets the bytes as a single UTF-8 string and appends it to buf.

This is an async version of std::io::Read::read_to_string.

Errors

Returns any Err(std::io::Error) returned by std::net::TcpStream::read.

Returns ErrorKind::InvalidData if the bytes are not valid UTF-8.

Reads the exact number of bytes required to fill buf.

This is an async version of std::io::Read::read_exact.

Errors

Returns any Err(std::io::Error) returned by std::net::TcpStream::read.

Reads bytes into bufs, filling each buffer in order. The final buffer written to may be partially filled.

Returns the total number of bytes read.

This is an async version of std::net::TcpStream::read_vectored.

Errors

Returns any Err(std::io::Error) returned by std::net::TcpStream::read_vectored.

Waits to receive some data on the socket, then copies it into buf.

Returns the number of bytes copied.

Repeated calls return the same data. Call read to remove data from the socket.

This is an async version of std::net::TcpStream::peek.

Errors

Returns any Err(std::io::Error) returned by std::net::TcpStream::peek.

Writes the bytes in buf to the socket. Returns the number of bytes written.

Errors

Returns any Err(std::io::Error) returned by std::net::TcpStream::write.

Sends all buffered data that was previously written on this socket and waits for receipt confirmation by the remote machine.

Errors

Returns std::io::Error if the connection failed or the remote machine did not respond within a timeout period.

Writes all bytes in buf to the socket.

Errors

Returns any Err(std::io::Error) returned by std::net::TcpStream::write.

Writes data from a slice of buffers.

Takes data from each buffer in order. May partially read the last buffer read.

Returns the number of bytes written.

Errors

Returns any Err(std::io::Error) returned by std::net::TcpStream::write_vectored.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.