Skip to main content

Factory

Trait Factory 

Source
pub trait Factory: Send + Sync {
    // Required method
    fn resolve(&self) -> Arc<dyn Any + Send + Sync> ;

    // Provided method
    fn is_transient(&self) -> bool { ... }
}
Expand description

A factory that creates service instances (trait for external extensibility)

Required Methods§

Source

fn resolve(&self) -> Arc<dyn Any + Send + Sync>

Resolve the service, creating it if necessary

Provided Methods§

Source

fn is_transient(&self) -> bool

Check if this factory produces a new instance each time

Implementors§