Skip to main content

AppCreator

Trait AppCreator 

Source
pub trait AppCreator<ServerT: Server>:
    DerefMut<Target = AppCreatorBase<ServerT>>
    + Send
    + Clone
    + 'static {
    type ContextT: Default + Send + Clone + 'static;

    // Required methods
    fn new(config: &Config) -> Result<Self>;
    fn into_app(
        self,
        handle: &Handle<ServerT>,
        context: &Self::ContextT,
        generation: usize,
    ) -> ServerT::AppT;
}
Expand description

What’s cloned and moved accross threads by a Server to create its App instances.

Required Associated Types§

Source

type ContextT: Default + Send + Clone + 'static

When Apps are created a new AppCreator::ContextT is created, and a reference to it is passed to AppCreator::into_app.

Required Methods§

Source

fn new(config: &Config) -> Result<Self>

Creates a new instance of this AppCreator based on the given configuration.

Source

fn into_app( self, handle: &Handle<ServerT>, context: &Self::ContextT, generation: usize, ) -> ServerT::AppT

Create an App instance.

The handle Handle can be used to restart the server. It’s up to the implementor to clone it.

generation indicates how many times the server has been restarted while running this binary

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl AppCreator<ServerImpl<Details>> for pubhubs::servers::auths::server::AppCreator

Source§

impl AppCreator<ServerImpl<Details>> for pubhubs::servers::phc::server::AppCreator

Source§

impl AppCreator<ServerImpl<Details>> for pubhubs::servers::transcryptor::server::AppCreator