Skip to main content

ScriptEngine

Trait ScriptEngine 

Source
pub trait ScriptEngine {
    type JobScope;

Show 29 methods // Required methods fn eval(&mut self, code: &str, description: &str); fn eval_at(&mut self, code: &str, url: Option<&Url>, description: &str); fn eval_internal(&mut self, code: &str, description: &str); fn eval_module(&mut self, code: &str, url: Option<&Url>, description: &str); fn eval_json( &mut self, code: &str, description: &str, ) -> Result<Value, String>; fn set_import_map(&self, json: &str, base_url: Option<&Url>); fn poll_module_evaluations(&mut self); fn has_pending_module_evaluations(&self) -> bool; fn has_pending_module_loads(&self) -> bool; fn begin_job_slice(&self) -> Self::JobScope; fn job_budget(&self) -> Duration; fn set_job_budget(&self, duration: Duration); fn pending_task_count(&self) -> u64; fn job_slice_exhausted(&self) -> bool; fn jobs_remain(&self) -> bool; fn run_jobs(&mut self, description: &str); fn run_jobs_with_progress(&mut self, description: &str) -> bool; fn next_timer_deadline(&self) -> Option<Instant>; fn run_due_timers(&mut self, profiling: bool) -> bool; fn dispatch_dom_event( &mut self, chain: &[NodeId], event: &DomEvent, event_state: &mut EventState, profiling: bool, ) -> bool; fn dispatch_document_event(&mut self, name: &str) -> bool; fn dispatch_node_event(&mut self, node_id: NodeId, name: &str) -> bool; fn dispatch_window_event(&mut self, name: &str) -> bool; fn set_document_ready_state(&mut self, next: &'static str) -> bool; fn sweep_detached_nodes(&mut self); fn poll_domc(&mut self) -> bool; fn console_entries_after(&self, sequence: u64) -> Vec<DiagnosticEntry>; fn runtime_errors_after(&self, sequence: u64) -> Vec<DiagnosticEntry>; fn diagnostic_batch( &self, console_after: u64, errors_after: u64, limit: usize, ) -> DiagnosticBatch;
}
Expand description

Operations used by the document and event driver to enter script execution.

JobScope is an owned guard, so a checkpoint can share the outer budget without retaining a borrow of the engine during a host callback.

Required Associated Types§

Required Methods§

Source

fn eval(&mut self, code: &str, description: &str)

Source

fn eval_at(&mut self, code: &str, url: Option<&Url>, description: &str)

Source

fn eval_internal(&mut self, code: &str, description: &str)

Source

fn eval_module(&mut self, code: &str, url: Option<&Url>, description: &str)

Source

fn eval_json(&mut self, code: &str, description: &str) -> Result<Value, String>

Source

fn set_import_map(&self, json: &str, base_url: Option<&Url>)

Source

fn poll_module_evaluations(&mut self)

Source

fn has_pending_module_evaluations(&self) -> bool

Source

fn has_pending_module_loads(&self) -> bool

Source

fn begin_job_slice(&self) -> Self::JobScope

Source

fn job_budget(&self) -> Duration

Source

fn set_job_budget(&self, duration: Duration)

Source

fn pending_task_count(&self) -> u64

Source

fn job_slice_exhausted(&self) -> bool

Source

fn jobs_remain(&self) -> bool

Source

fn run_jobs(&mut self, description: &str)

Source

fn run_jobs_with_progress(&mut self, description: &str) -> bool

Source

fn next_timer_deadline(&self) -> Option<Instant>

Source

fn run_due_timers(&mut self, profiling: bool) -> bool

Source

fn dispatch_dom_event( &mut self, chain: &[NodeId], event: &DomEvent, event_state: &mut EventState, profiling: bool, ) -> bool

Source

fn dispatch_document_event(&mut self, name: &str) -> bool

Source

fn dispatch_node_event(&mut self, node_id: NodeId, name: &str) -> bool

Source

fn dispatch_window_event(&mut self, name: &str) -> bool

Source

fn set_document_ready_state(&mut self, next: &'static str) -> bool

Source

fn sweep_detached_nodes(&mut self)

Source

fn poll_domc(&mut self) -> bool

Source

fn console_entries_after(&self, sequence: u64) -> Vec<DiagnosticEntry>

Source

fn runtime_errors_after(&self, sequence: u64) -> Vec<DiagnosticEntry>

Source

fn diagnostic_batch( &self, console_after: u64, errors_after: u64, limit: usize, ) -> DiagnosticBatch

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§