Skip to main content

EngineRuntime

Struct EngineRuntime 

Source
pub struct EngineRuntime { /* private fields */ }

Implementations§

Source§

impl EngineRuntime

Source

pub fn spawn<F>(make: F) -> EngineResult<Self>
where F: FnOnce() -> EngineResult<Box<dyn Engine>> + Send + 'static,

Spawn the engine thread and construct the engine on that thread via make. This is the only correct construction point: the platform run loop must be initialized on the same thread that later drives WebKit.

Returns once the engine thread has signaled it is ready.

Source

pub fn dispatcher(engine: Box<dyn Engine>) -> (Self, MainThreadDispatcher)

Construct a runtime whose engine runs on the caller’'‘s thread. No internal thread is spawned. The returned MainThreadDispatcher drives the engine: call MainThreadDispatcher::tick in the caller’'’s loop to drain one queued job, or [MainThreadDispatcher::run_until] to block until a stop flag fires.

Use this when the engine is bound to a specific OS thread (e.g. the macOS Cocoa main thread, where WKWebView must run).

Source

pub fn with_waker(self, waker: Waker) -> Self

Install the Waker the host loop is woken by.

Call before the runtime is shared. Without one the host must poll; with one it can sleep until there is actually work.

Source

pub fn shutdown(&mut self)

Cleanly shut down: close the channel and join the thread. Idempotent — calling shutdown twice is a no-op.

Source

pub fn open(&self, url: &str) -> EngineResult<PageHandle>

Source

pub fn navigate(&self, page: PageHandle, url: &str) -> EngineResult<()>

Source

pub fn close(&self, page: PageHandle) -> EngineResult<()>

Source

pub fn enable_webauthn(&self, page: PageHandle) -> EngineResult<()>

Source

pub fn add_init_script( &self, page: PageHandle, source: &str, ) -> EngineResult<()>

Source

pub fn snapshot(&self, page: PageHandle) -> EngineResult<Tree>

Source

pub fn snapshot_with_console( &self, page: PageHandle, ) -> EngineResult<(Tree, Vec<ConsoleEntry>)>

Snapshot the tree and read the console buffer in a single main-thread hop. vs_view needs both (the tree, plus the console entries behind its ? console_error warning); folding the cheap native console read into the snapshot dispatch avoids a second round trip on every view. The console read is a buffer borrow, so it adds no measurable cost.

Source

pub fn act( &self, page: PageHandle, target: ActTarget, action: Action, mode: InputMode, ) -> EngineResult<()>

Source

pub fn act_and_snapshot( &self, page: PageHandle, target: ActTarget, action: Action, mode: InputMode, ) -> EngineResult<Tree>

Perform an action and snapshot the resulting tree in a single main-thread hop. vs_act always snapshots right after acting, so folding the two into one dispatch removes a full engine round trip (~10ms) from every action. The backend’s act already settles input + flushes rAF before returning, so the snapshot sees the post-action DOM exactly as the two-call form did.

Source

pub fn wait( &self, page: PageHandle, cond: WaitCondition, budget: Duration, ) -> EngineResult<()>

Source

pub fn capture( &self, page: PageHandle, scope: CaptureScope, ) -> EngineResult<PathBuf>

Source

pub fn capture_live( &self, page: PageHandle, max_width: u32, ) -> EngineResult<PathBuf>

Source

pub fn record_begin( &self, page: PageHandle, tx: Sender<RecFrame>, fps: u32, max_width: u32, ) -> EngineResult<()>

Source

pub fn record_end(&self, page: PageHandle) -> EngineResult<()>

Source

pub fn layout( &self, page: PageHandle, refs: Vec<Ref>, ) -> EngineResult<Vec<LayoutBox>>

Source

pub fn download( &self, page: PageHandle, source: DownloadSource, budget: Duration, ) -> EngineResult<Download>

Source

pub fn download_list( &self, page: PageHandle, ) -> EngineResult<Vec<DownloadEntry>>

Source

pub fn set_viewport( &self, page: PageHandle, viewport: Viewport, ) -> EngineResult<()>

Source

pub fn save_auth(&self, page: PageHandle) -> EngineResult<AuthBlob>

Source

pub fn load_auth(&self, page: PageHandle, blob: AuthBlob) -> EngineResult<()>

Source

pub fn console_entries( &self, page: PageHandle, ) -> EngineResult<Vec<ConsoleEntry>>

Source

pub fn network_entries( &self, page: PageHandle, ) -> EngineResult<Vec<NetworkEntry>>

Source

pub fn request_detail( &self, page: PageHandle, seq: u64, ) -> EngineResult<Option<RequestDetail>>

Source

pub fn eval_js(&self, page: PageHandle, expr: &str) -> EngineResult<EvalResult>

Source

pub fn storage( &self, page: PageHandle, scope: StorageScope, ) -> EngineResult<Vec<StorageEntry>>

Source

pub fn cookie_events(&self, page: PageHandle) -> EngineResult<Vec<CookieEvent>>

Source

pub fn type_text( &self, page: PageHandle, text: &str, mode: InputMode, ) -> EngineResult<()>

Source

pub fn cursor_op( &self, page: PageHandle, op: CursorOp, mode: InputMode, ) -> EngineResult<()>

Source

pub fn scripts(&self, page: PageHandle) -> EngineResult<Vec<ScriptEntry>>

Source

pub fn script_source( &self, page: PageHandle, seq: u64, ) -> EngineResult<Option<ScriptSource>>

Source

pub fn dom( &self, page: PageHandle, r: Ref, extra_props: Vec<String>, ) -> EngineResult<Option<DomDetail>>

Source

pub fn performance(&self, page: PageHandle) -> EngineResult<PerformanceMetrics>

Source

pub fn capabilities(&self) -> EngineResult<EngineCapabilities>

Trait Implementations§

Source§

impl Debug for EngineRuntime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for EngineRuntime

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more