Skip to main content

Acceptor

Trait Acceptor 

Source
pub trait Acceptor:
    Send
    + Sync
    + 'static {
    // Required method
    fn accept(&self, info: &ConnInfo) -> Option<Box<dyn Connection>>;
}
Expand description

Creates a Connection for each accepted socket. Shared by every loop, so it must be Send + Sync; any closure Fn(&ConnInfo) -> Option<Box<dyn Connection>> is one.

Required Methods§

Source

fn accept(&self, info: &ConnInfo) -> Option<Box<dyn Connection>>

Returns the connection’s handler, or None to close the socket at once.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F> Acceptor for F
where F: Fn(&ConnInfo) -> Option<Box<dyn Connection>> + Send + Sync + 'static,