Struct safina_net::TcpListener[][src]

pub struct TcpListener { /* fields omitted */ }

Async wrapper around std::net::TcpListener.

You can borrow the inner struct with inner and inner_mut.

Implementations

impl TcpListener[src]

pub fn new(std_listener: TcpListener) -> Result<Self, Error>[src]

Wraps an existing listener socket so we can perform async operations on it.

Errors

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

pub fn bind<A: ToSocketAddrs>(addr: A) -> Result<TcpListener, Error>[src]

Returns a TCP listener socket, bound to addr, that is ready to accept connections.

Errors

Returns any Err(std::io::Error) returned by the underlying std::net::TcpListener::bind method.

#[must_use]pub fn inner(&self) -> &TcpListener[src]

#[must_use]pub fn into_inner(self) -> TcpListener[src]

pub fn try_clone(&self) -> Result<TcpListener, Error>[src]

Makes a new handle to this socket.

Errors

Returns any Err(std::io::Error) returned by the underlying std::net::TcpListener::try_clone method.

pub async fn accept(&self) -> Result<(TcpStream, SocketAddr), Error>[src]

Waits for a new connection and then accepts it. Returns the address of the remote side of the connection and a stream for reading and writing the connection.

Errors

Returns an error if it fails to create a new socket. This happens when the process runs out of file descriptors.

Trait Implementations

impl Debug for TcpListener[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.