Skip to main content

AddDaemonServiceExt

Trait AddDaemonServiceExt 

Source
pub trait AddDaemonServiceExt {
    // Required methods
    fn add_daemon_service<T>(&mut self) -> &mut Self
       where T: Service<Handle = Arc<T>> + Daemon + 'static;
    fn has_daemon_service<T>(&self) -> bool
       where T: Service<Handle = Arc<T>> + Daemon + 'static;
}
Expand description

Registers daemons resolved from the dependency-injection container.

The daemon type T is a Service: it is built by the container (together with its dependencies) and its handle is registered as a Daemon. The service is added automatically if it is not already present.

Required Methods§

Source

fn add_daemon_service<T>(&mut self) -> &mut Self
where T: Service<Handle = Arc<T>> + Daemon + 'static,

Registers the Service T to be run as a daemon.

§Panics

Panics if T is already registered as a daemon service (its provider plugin would be added twice); guard with has_daemon_service when this can happen. Building the App additionally panics if T is registered both as a daemon service and as an instance via AddDaemonExt::add_daemon.

Source

fn has_daemon_service<T>(&self) -> bool
where T: Service<Handle = Arc<T>> + Daemon + 'static,

Returns whether T is registered as a daemon service.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl AddDaemonServiceExt for AppBuilder

Source§

fn add_daemon_service<T>(&mut self) -> &mut Self
where T: Service<Handle = Arc<T>> + Daemon + 'static,

Source§

fn has_daemon_service<T>(&self) -> bool
where T: Service<Handle = Arc<T>> + Daemon + 'static,

Implementors§