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]
service: Arc<dyn Any + 'static + Sync + Send>
) -> Result<Arc<Self>, InjectError>
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]
service: Box<dyn Any + 'static + Sync + Send, Global>
) -> Result<Box<Self, Global>, InjectError>
Downcasts an owned dynamic service pointer into an owned service pointer of this interface type.
Implementors
Loading content...