Trait runtime_injector_actix::Interface[][src]

pub trait Interface: Service {
    fn downcast(
        service: Arc<dyn Any + 'static + Sync + Send>
    ) -> Result<Arc<Self>, InjectError>;
fn downcast_owned(
        service: Box<dyn Any + 'static + Sync + Send, Global>
    ) -> Result<Box<Self, Global>, InjectError>; }

Indicates that a type can resolve services. The most basic implementation of this trait is that each sized service type can resolve itself. This is done by requesting the exact implementation of itself from the injector. However, the injector cannot provide exact implementations for dynamic types (dyn Trait). For this reason, any interfaces using traits must be declared explicitly before use. This trait should usually be implemented by the interface! macro.

Required methods

fn downcast(
    service: Arc<dyn Any + 'static + Sync + Send>
) -> Result<Arc<Self>, InjectError>
[src]

Downcasts a dynamic service pointer into a service pointer of this interface type.

fn downcast_owned(
    service: Box<dyn Any + 'static + Sync + Send, Global>
) -> Result<Box<Self, Global>, InjectError>
[src]

Downcasts an owned dynamic service pointer into an owned service pointer of this interface type.

Loading content...

Implementors

impl<T> Interface for T where
    T: Service
[src]

pub fn downcast(
    service: Arc<dyn Any + 'static + Sync + Send>
) -> Result<Arc<T>, InjectError>
[src]

pub fn downcast_owned(
    service: Box<dyn Any + 'static + Sync + Send, Global>
) -> Result<Box<T, Global>, InjectError>
[src]

Loading content...