Skip to main content

AutomatonConstructor

Trait AutomatonConstructor 

Source
pub trait AutomatonConstructor: Send + Sync {
    // Required methods
    fn type_name(&self) -> &'static str;
    fn construct(
        &self,
        id: &str,
        params: &Params,
        target: &ServoTarget,
    ) -> BoxedModule;
    fn clone_box(&self) -> Box<dyn AutomatonConstructor>;

    // Provided method
    fn spawn_async(
        &self,
        _id: &str,
        _params: &Params,
        _target: &ServoTarget,
        _interval_ms: f64,
        _command_queue: ActorRef<CommandEnum>,
    ) -> Option<JoinHandle<()>> { ... }
}
Expand description

Constructs automaton modules from type name, params, and target.

Required Methods§

Source

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

Returns the string key used to register this constructor.

Source

fn construct( &self, id: &str, params: &Params, target: &ServoTarget, ) -> BoxedModule

Builds a boxed module from the given id, params, and servo target.

Source

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

Returns a heap-allocated clone of this constructor.

Provided Methods§

Source

fn spawn_async( &self, _id: &str, _params: &Params, _target: &ServoTarget, _interval_ms: f64, _command_queue: ActorRef<CommandEnum>, ) -> Option<JoinHandle<()>>

Optionally spawns an async green-thread for automata that run independently of the graph clock.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§