Skip to main content

ServerConfiguration

Trait ServerConfiguration 

Source
pub trait ServerConfiguration:
    Send
    + Clone
    + 'static {
    type Item: Send + 'static;
    type Service: Service<(), Self::Item, Res = (), Error = ()> + 'static;

    // Required method
    async fn create(&self) -> Result<Self::Service>;

    // Provided methods
    fn pause(&self) { ... }
    fn resume(&self) { ... }
    fn terminate(&self) { ... }
    async fn stop(&self) { ... }
}
Expand description

Worker service configuration.

Required Associated Types§

Source

type Item: Send + 'static

Source

type Service: Service<(), Self::Item, Res = (), Error = ()> + 'static

Required Methods§

Source

async fn create(&self) -> Result<Self::Service>

Create service for handling WorkerMessage<T> messages.

Provided Methods§

Source

fn pause(&self)

Pause the server.

Source

fn resume(&self)

Resume the server.

Source

fn terminate(&self)

Server is stopped.

Source

async fn stop(&self)

Server is stopped.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<Cfg: ServerAppConfig> ServerConfiguration for StreamServer<Cfg>

Worker service factory.

Source§

type Item = Connection

Source§

type Service = StreamService