Trait Dependency

Source
pub trait Dependency<Deps> {
    // Required method
    fn init(deps: Deps) -> Self;
}
Expand description

Trait is used to working with Resolver trait. If you want that your service can be resolved by Resolver, you may implement this trait for your service. There are three ways:

  1. Implement it by yourself. Not recommended for production code, recommended for library code.
  2. Create a constructor and add #[inject] macro. Recommended for production code.
  3. Derive Teloc macro, when all of your fields of structs implement Dependency.

Required Methods§

Source

fn init(deps: Deps) -> Self

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.

Implementations on Foreign Types§

Source§

impl<Deps, D> Dependency<Deps> for Box<D>
where D: Dependency<Deps>,

Source§

fn init(deps: Deps) -> Self

Source§

impl<Deps, D> Dependency<Deps> for Rc<D>
where D: Dependency<Deps>,

Source§

fn init(deps: Deps) -> Self

Source§

impl<Deps, D> Dependency<Deps> for Arc<D>
where D: Dependency<Deps>,

Source§

fn init(deps: Deps) -> Self

Source§

impl<Deps, D> Dependency<Deps> for RefCell<D>
where D: Dependency<Deps>,

Source§

fn init(deps: Deps) -> Self

Implementors§