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

A socket listening on a TCP port.

The TcpListener::accept method is meant to be used in async contexts.

Implementations

Creates a new TCP listener.

It is configured to listen on the given socket address for the given namespace.

Accepts a new connection.

Returns a future that when ready indicates the result of the accept operation; on success, it contains the newly-accepted tcp stream.

Methods from Deref<Target = TcpListener>

Accepts a new connection.

On success, returns the newly-accepted socket stream.

If no connection is available to be accepted, one of two behaviours will occur:

  • If block is false, returns crate::error::code::EAGAIN;
  • If block is true, blocks until an error occurs or some connection can be accepted.

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

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.