Skip to main content

AddDaemonExt

Trait AddDaemonExt 

Source
pub trait AddDaemonExt {
    // Required methods
    fn add_daemon<T>(&self, daemon: impl Into<Arc<T>>)
       where T: Daemon + 'static;
    fn has_daemon<T>(&self) -> bool
       where T: Daemon + 'static;
}
Expand description

Registers concrete Daemon instances on the application.

This extension lives on AppContext, so daemons can be registered both while configuring the builder and from within a plugin’s build. A daemon is identified by its type.

Required Methods§

Source

fn add_daemon<T>(&self, daemon: impl Into<Arc<T>>)
where T: Daemon + 'static,

Registers daemon to be run by RunDaemonsExt::run_daemons.

§Panics

Panics if a daemon of type T is already registered. Guard with has_daemon when the same type may be registered more than once.

Source

fn has_daemon<T>(&self) -> bool
where T: Daemon + 'static,

Returns whether a daemon of type T is registered.

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 AddDaemonExt for AppContext

Source§

fn add_daemon<T>(&self, daemon: impl Into<Arc<T>>)
where T: Daemon + 'static,

Source§

fn has_daemon<T>(&self) -> bool
where T: Daemon + 'static,

Implementors§