Skip to main content

EngineRuntime

Struct EngineRuntime 

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

Owns the engine thread and exposes a synchronous facade.

Drop semantics: dropping the runtime closes the command channel, which causes the engine thread to exit its loop and drop the engine. The destructor joins the thread.

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 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 close(&self, page: PageHandle) -> EngineResult<()>

Source

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

Source

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

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 layout( &self, page: PageHandle, refs: Vec<Ref>, ) -> EngineResult<Vec<LayoutBox>>

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 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, 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.