Skip to main content

ModuleFactory

Trait ModuleFactory 

Source
pub trait ModuleFactory: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn create(&self, context: &Context) -> Box<dyn Module>;
    fn config<'a>(&self, context: &'a Context) -> Option<&'a dyn ModuleConfig>;
}
Expand description

Factory trait for constructing modules and exposing their config binding

Required Methods§

Source

fn name(&self) -> &'static str

Canonical module name (e.g., “directory”)

Source

fn create(&self, context: &Context) -> Box<dyn Module>

Create a fresh module instance for the given context

Source

fn config<'a>(&self, context: &'a Context) -> Option<&'a dyn ModuleConfig>

Obtain the module-specific config view from Context

Implementors§