Trait fizyr_rpc::util::Listener

source ·
pub trait Listener {
    type Connection: Debug;
    type Address: Debug;

    // Required method
    fn poll_accept(
        self: Pin<&mut Self>,
        context: &mut Context<'_>
    ) -> Poll<Result<(Self::Connection, Self::Address)>>;

    // Provided method
    fn accept(&mut self) -> Accept<'_, Self> 
       where Self: Unpin { ... }
}
Expand description

Trait for listeners that can accept new connections.

Required Associated Types§

source

type Connection: Debug

The type of the connections return by the Self::accept() function.

source

type Address: Debug

The type of the address returned by the Self::accept() function.

Required Methods§

source

fn poll_accept( self: Pin<&mut Self>, context: &mut Context<'_> ) -> Poll<Result<(Self::Connection, Self::Address)>>

Try to accept a new connection without blocking.

If no new connection is available, the current task is scheduled to wake up when a new connection is ready.

Provided Methods§

source

fn accept(&mut self) -> Accept<'_, Self>
where Self: Unpin,

Asynchronously accept a new connection.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Listener for UnixSeqpacketListener

§

type Address = ()

§

type Connection = UnixSeqpacket

source§

fn poll_accept( self: Pin<&mut Self>, context: &mut Context<'_> ) -> Poll<Result<(Self::Connection, Self::Address)>>

source§

impl Listener for TcpListener

§

type Address = SocketAddr

§

type Connection = TcpStream

source§

fn poll_accept( self: Pin<&mut Self>, context: &mut Context<'_> ) -> Poll<Result<(Self::Connection, Self::Address)>>

source§

impl Listener for UnixListener

§

type Address = ()

§

type Connection = UnixStream

source§

fn poll_accept( self: Pin<&mut Self>, context: &mut Context<'_> ) -> Poll<Result<(Self::Connection, Self::Address)>>

source§

impl<P> Listener for Pin<P>
where P: DerefMut + Unpin, P::Target: Listener,

§

type Address = <<P as Deref>::Target as Listener>::Address

§

type Connection = <<P as Deref>::Target as Listener>::Connection

source§

fn poll_accept( self: Pin<&mut Self>, context: &mut Context<'_> ) -> Poll<Result<(Self::Connection, Self::Address)>>

source§

impl<T> Listener for &mut T
where T: Listener + Unpin + ?Sized,

§

type Address = <T as Listener>::Address

§

type Connection = <T as Listener>::Connection

source§

fn poll_accept( self: Pin<&mut Self>, context: &mut Context<'_> ) -> Poll<Result<(Self::Connection, Self::Address)>>

source§

impl<T> Listener for Box<T>
where T: Listener + Unpin + ?Sized,

§

type Address = <T as Listener>::Address

§

type Connection = <T as Listener>::Connection

source§

fn poll_accept( self: Pin<&mut Self>, context: &mut Context<'_> ) -> Poll<Result<(Self::Connection, Self::Address)>>

Implementors§