pal_async::socket

Trait Listener

Source
pub trait Listener: AsSockRef {
    type Socket: AsSockRef + Read + Write + Into<Socket>;
    type Address: Debug;

    // Required methods
    fn accept(&self) -> Result<(Self::Socket, Self::Address)>;
    fn local_addr(&self) -> Result<Self::Address>;
}
Expand description

Trait for listening sockets.

Required Associated Types§

Source

type Socket: AsSockRef + Read + Write + Into<Socket>

The socket type.

Source

type Address: Debug

The socket address type.

Required Methods§

Source

fn accept(&self) -> Result<(Self::Socket, Self::Address)>

Accepts an incoming socket.

Source

fn local_addr(&self) -> Result<Self::Address>

Returns the local address of the listener.

Implementations on Foreign Types§

Source§

impl Listener for TcpListener

Source§

impl Listener for UnixListener

Source§

impl Listener for Socket

Source§

type Socket = Socket

Source§

type Address = SockAddr

Source§

fn accept(&self) -> Result<(Self::Socket, Self::Address)>

Source§

fn local_addr(&self) -> Result<Self::Address>

Source§

impl<'a, T> Listener for &'a T

Source§

type Socket = <T as Listener>::Socket

Source§

type Address = <T as Listener>::Address

Source§

fn accept(&self) -> Result<(Self::Socket, Self::Address)>

Source§

fn local_addr(&self) -> Result<Self::Address>

Implementors§