pub trait ConfiguredMakeService<O, C, Cfg>: Send + Sync + 'staticwhere
    Cfg: ResourceConfig<O, C>,
{ type MakeService; fn make(
        &self,
        spirit: &Arc<Spirit<O, C>>,
        cfg: &Arc<Cfg>,
        resource: &Cfg::Resource,
        name: &str
    ) -> Self::MakeService; }
Expand description

Factory for MakeService implementations.

Each HTTP connection needs its own Service instance. As the hyper server accepts the connections, it uses the MakeService factory to create them.

The configuration needs to spawn whole new servers (each with its own MakeService). Therefore, we introduce another level ‒ this trait. It is passed to the server function.

There’s a blanket implementation for compatible closures.

There are also functions similar to server which forgo some flexibility in favor of convenience.

Required Associated Types

The type of MakeService created.

Required Methods

Create a new MakeService instance.

Parameters
  • spirit: The spirit instance.
  • cfg: The configuration fragment that caused creation of the server.
  • resource: The acceptor (eg. TcpListener::accept) the server will use.
  • name: Logging name.

Implementors