Skip to main content

MainThreadDispatcher

Struct MainThreadDispatcher 

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

Drives an engine that lives on the caller’'’s thread (typically the OS main thread on macOS, since WKWebView is pinned there). The driver owns the engine and a receiver for jobs sent by the runtime handle that the daemon holds.

Implementations§

Source§

impl MainThreadDispatcher

Source

pub fn tick(&mut self) -> Result<bool, ()>

Drain one job if available. Returns Ok(true) if a job was executed, Ok(false) if the queue is currently empty, Err(()) if the channel is closed (the runtime was dropped — the dispatcher should exit its loop).

Source

pub fn tick_blocking(&mut self) -> Result<bool, ()>

Block until a job arrives or the channel is closed; execute one job. Returns Ok(true) after running, Err(()) on closed.

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.