Skip to main content

ProviderServer

Trait ProviderServer 

Source
pub trait ProviderServer: Sized + Send {
    type Stream: ProviderStream;

    // Required methods
    fn bind(
        options: &ServerOptions,
    ) -> impl Future<Output = Result<Self>> + Send;
    fn accept(
        &mut self,
    ) -> impl Future<Output = Result<Poll<(Self::Stream, SocketAddr)>>> + Send;
    fn local_addr(&self) -> Result<SocketAddr>;

    // Provided method
    fn start(
        options: ServerOptions,
        service: Service<Handler>,
        statistics: Statistics,
        switch: Switch,
    ) -> impl Future<Output = Result<()>> + Send { ... }
}

Required Associated Types§

Required Methods§

Source

fn bind(options: &ServerOptions) -> impl Future<Output = Result<Self>> + Send

Bind the server to the specified address.

Source

fn accept( &mut self, ) -> impl Future<Output = Result<Poll<(Self::Stream, SocketAddr)>>> + Send

Accept a new connection.

Source

fn local_addr(&self) -> Result<SocketAddr>

Get the local address of the listener.

Provided Methods§

Source

fn start( options: ServerOptions, service: Service<Handler>, statistics: Statistics, switch: Switch, ) -> impl Future<Output = Result<()>> + Send

Start the server.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§