Trait trillium_server_common::Server[][src]

pub trait Server: Sized {
    type Transport: Transport;
    fn run<A, H>(config: Config<Self, A>, handler: H)
    where
        A: Acceptor<Self::Transport>,
        H: Handler
;
fn run_async<'async_trait, A, H>(
        config: Config<Self, A>,
        handler: H
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        A: Acceptor<Self::Transport>,
        H: Handler,
        A: 'async_trait,
        H: 'async_trait,
        Self: 'async_trait
; fn peer_ip(_transport: &Self::Transport) -> Option<IpAddr> { ... } }
Expand description

The server trait, for standard network-based server implementations.

Associated Types

The Transport type to use for this server implementation. This is often something like a TcpStream.

Required methods

entrypoint to run a handler with a given config. if this function is called, it is safe to assume that we are not yet within an async runtime’s block_on. generally this should just entail a call to my_runtime::block_on(Self::run_async(config, handler))

entrypoint to run a handler with a given config within a preexisting runtime

Provided methods

Determine the remote ip/port for the Transport.

Implementors