pub struct LocalEngine<M: TextEngine + 'static> { /* private fields */ }Expand description
An engine driven by its host’s event loop instead of a thread of its
own: the browser’s main thread in WebAssembly, where there are no
threads to block. Input sent through its EngineControl is handled
at the next LocalEngine::pump.
Implementations§
Source§impl<M: TextEngine + 'static> LocalEngine<M>
impl<M: TextEngine + 'static> LocalEngine<M>
Sourcepub fn start<S: MountSink>(
config: EngineConfig,
text_engine: M,
sink: S,
) -> Option<Self>
pub fn start<S: MountSink>( config: EngineConfig, text_engine: M, sink: S, ) -> Option<Self>
Starts the app (its first frame goes to sink before this returns);
None if it could not start (reported to sink).
Sourcepub fn control(&self) -> EngineControl
pub fn control(&self) -> EngineControl
A handle for sending input.
Sourcepub fn set_wake(&mut self, wake: Arc<dyn Fn() + Send + Sync>)
pub fn set_wake(&mut self, wake: Arc<dyn Fn() + Send + Sync>)
Calls wake when there is work outside a pump: a
component task is woken or Rust posts a JS call while no pump runs
(a callback of the host’s completing what a task waits for, such as
a WebSocket message through wasm-bindgen), once per wake-up, or a
pump ends with work its bound left. The host then calls pump soon,
instead of only at the deadline it returned or at the next input.
What a pump wakes itself (a task waking another, a reply it hands
over) it runs without calling wake.
Sourcepub fn extend_ui_sets(&mut self, ui_sets: &[Registry])
pub fn extend_ui_sets(&mut self, ui_sets: &[Registry])
Serves ui_sets (a superset of the config’s, after a UI set or
part was registered while the app runs: the web runtime’s late
gates) to what is mounted from now on.