Skip to main content

ModuleConstructor

Trait ModuleConstructor 

Source
pub trait ModuleConstructor: Send + Sync {
    // Required methods
    fn type_name(&self) -> &'static str;
    fn construct(
        &self,
        module: &ModuleDef,
        automaton_defs: &[AutomatonDef],
        system: &Arc<ActorSystem>,
        graph_ref: &ActorRef<CommandEnum>,
    ) -> Result<ActorRef<CommandEnum>, ModuleError>;
    fn clone_box(&self) -> Box<dyn ModuleConstructor>;
}
Expand description

Constructs rack modules from a ModuleDef descriptor.

Each constructor receives the full module descriptor plus the list of automaton definitions needed by Servo modules. Custom and registered constructors return an ActorRef<CommandEnum> that the rack actor uses for fan-out.

Required Methods§

Source

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

Returns the string key used to register this constructor.

Source

fn construct( &self, module: &ModuleDef, automaton_defs: &[AutomatonDef], system: &Arc<ActorSystem>, graph_ref: &ActorRef<CommandEnum>, ) -> Result<ActorRef<CommandEnum>, ModuleError>

Build the module and return its actor handle.

automaton_defs provides the automaton definitions referenced by ModuleDef::Servo. Other module types ignore this parameter.

Source

fn clone_box(&self) -> Box<dyn ModuleConstructor>

Returns a heap-allocated clone of this constructor.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§