pub struct AutomatonFactory { /* private fields */ }Expand description
Registry that maps automaton type names to constructors.
Implementations§
Source§impl AutomatonFactory
impl AutomatonFactory
Sourcepub fn register(&mut self, ctor: impl AutomatonConstructor + 'static)
pub fn register(&mut self, ctor: impl AutomatonConstructor + 'static)
Adds a typed constructor to the registry, keyed by its type name.
Sourcepub fn register_fn(
&mut self,
type_name: &'static str,
f: impl Fn(&str, &Params, &ServoTarget) -> BoxedModule + Send + Sync + 'static,
)
pub fn register_fn( &mut self, type_name: &'static str, f: impl Fn(&str, &Params, &ServoTarget) -> BoxedModule + Send + Sync + 'static, )
Registers a closure-based constructor under the given type name.
Sourcepub fn construct(
&self,
type_name: &str,
id: &str,
params: &Params,
target: &ServoTarget,
) -> Result<BoxedModule, FactoryError>
pub fn construct( &self, type_name: &str, id: &str, params: &Params, target: &ServoTarget, ) -> Result<BoxedModule, FactoryError>
Looks up a type name and constructs the corresponding automaton module.
Sourcepub fn spawn_async(
&self,
type_name: &str,
id: &str,
params: &Params,
target: &ServoTarget,
interval_ms: f64,
command_queue: ActorRef<CommandEnum>,
) -> Result<Option<JoinHandle<()>>, FactoryError>
pub fn spawn_async( &self, type_name: &str, id: &str, params: &Params, target: &ServoTarget, interval_ms: f64, command_queue: ActorRef<CommandEnum>, ) -> Result<Option<JoinHandle<()>>, FactoryError>
Looks up a type name and spawns its async green-thread if supported.
Sourcepub fn list_types(&self) -> Vec<&'static str>
pub fn list_types(&self) -> Vec<&'static str>
Lists all registered automaton type names.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AutomatonFactory
impl !RefUnwindSafe for AutomatonFactory
impl Send for AutomatonFactory
impl Sync for AutomatonFactory
impl Unpin for AutomatonFactory
impl UnsafeUnpin for AutomatonFactory
impl !UnwindSafe for AutomatonFactory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more