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
impl MainThreadDispatcher
Sourcepub fn tick(&mut self) -> Result<bool, ()>
pub fn tick(&mut self) -> Result<bool, ()>
Look in on pending calls, then 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).
A pending call finishes on a later tick, once the host loop has
run the engine’s events.
Sourcepub fn tick_blocking(&mut self) -> Result<bool, ()>
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§
impl !RefUnwindSafe for MainThreadDispatcher
impl !Send for MainThreadDispatcher
impl !Sync for MainThreadDispatcher
impl !UnwindSafe for MainThreadDispatcher
impl Forget for MainThreadDispatcher
impl Freeze for MainThreadDispatcher
impl Move for MainThreadDispatcher
impl Unpin for MainThreadDispatcher
impl UnsafeUnpin for MainThreadDispatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more