Trait SingletonCtorDeps

Source
pub trait SingletonCtorDeps<T, Deps>:
    FnOnce(Deps) -> T
    + Send
    + Sync
    + 'static {
    // Required method
    fn call(
        self,
        deps: Deps,
        _: SealToken,
    ) -> Result<T, Box<dyn Error + Send + Sync>>;
}
Expand description

A generic constructor for singletons with dependencies.

This is a marker trait to identify all valid constructors usable by singletons. It’s not implementable by other crates.

A blanket implementation for FnOnce(Deps) -> T is provided.

Required Methods§

Source

fn call( self, deps: Deps, _: SealToken, ) -> Result<T, Box<dyn Error + Send + Sync>>

Calls the construcor.

Implementors§

Source§

impl<T, F, Deps> SingletonCtorDeps<T, Deps> for F
where F: FnOnce(Deps) -> T + Send + Sync + 'static, Deps: DepBuilder<T> + 'static,