pub struct TcpStream { /* private fields */ }
Expand description

A connected TCP socket.

Invariants

The socket pointer is always non-null and valid.

Implementations

Reads data from a connected socket.

On success, returns the number of bytes read, which will be zero if the connection is closed.

If no data is immediately available for reading, one of two behaviours will occur:

  • If block is false, returns crate::error::code::EAGAIN;
  • If block is true, blocks until an error occurs, the connection is closed, or some becomes readable.

Writes data to the connected socket.

On success, returns the number of bytes written.

If the send buffer of the socket is full, one of two behaviours will occur:

Trait Implementations

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

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.
This documentation is an old archive. Please see https://rust.docs.kernel.org instead.