pub struct RuntimeDriver<G, H>where
G: NativeDocumentRuntime,
H: NativeHost<Guest = G> + 'static,{ /* private fields */ }Expand description
A document runtime backed by one caller supplied native guest and host.
Implementations§
Source§impl<G, H> RuntimeDriver<G, H>where
G: NativeDocumentRuntime,
H: NativeHost<Guest = G> + 'static,
impl<G, H> RuntimeDriver<G, H>where
G: NativeDocumentRuntime,
H: NativeHost<Guest = G> + 'static,
Sourcepub fn new_bound(
html: Arc<str>,
config: DocumentConfig,
host: H,
) -> Result<Self, String>
pub fn new_bound( html: Arc<str>, config: DocumentConfig, host: H, ) -> Result<Self, String>
Parse HTML and bind the supplied host and its guest.
Sourcepub fn from_document(
document: BoundScriptDocument<G, H>,
) -> Result<Self, String>
pub fn from_document( document: BoundScriptDocument<G, H>, ) -> Result<Self, String>
Wrap an already parsed and bound document.
Sourcepub fn document(&self) -> &BoundScriptDocument<G, H>
pub fn document(&self) -> &BoundScriptDocument<G, H>
Borrow the bound document.
Sourcepub fn document_mut(&mut self) -> &mut BoundScriptDocument<G, H>
pub fn document_mut(&mut self) -> &mut BoundScriptDocument<G, H>
Mutably borrow the bound document.
Sourcepub fn into_document(self) -> BoundScriptDocument<G, H>
pub fn into_document(self) -> BoundScriptDocument<G, H>
Consume the driver and return its bound document.
Sourcepub fn execute_scripts(&mut self) -> Result<(), String>
pub fn execute_scripts(&mut self) -> Result<(), String>
Execute the document’s scripts through its bound guest.
Sourcepub fn eval(&mut self, source: &str) -> Result<(), String>
pub fn eval(&mut self, source: &str) -> Result<(), String>
Evaluate source through the bound guest.
Sourcepub fn eval_named(&mut self, source: &str, name: &str) -> Result<(), String>
pub fn eval_named(&mut self, source: &str, name: &str) -> Result<(), String>
Evaluate named source through the bound guest.
Sourcepub fn eval_json(&mut self, source: &str) -> Result<Value, String>
pub fn eval_json(&mut self, source: &str) -> Result<Value, String>
Evaluate source and return its JSON-compatible result.
Sourcepub fn has_pending_jobs(&self) -> bool
pub fn has_pending_jobs(&self) -> bool
Whether the guest reports pending jobs for this document.
Sourcepub fn diagnostic_batch(
&self,
console_after: u64,
errors_after: u64,
limit: usize,
) -> Result<DiagnosticBatch, String>
pub fn diagnostic_batch( &self, console_after: u64, errors_after: u64, limit: usize, ) -> Result<DiagnosticBatch, String>
Return a bounded batch of diagnostics from the bound guest.
Sourcepub fn dispatch_node_event(
&mut self,
node: NodeId,
name: &str,
) -> Result<bool, String>
pub fn dispatch_node_event( &mut self, node: NodeId, name: &str, ) -> Result<bool, String>
Dispatch an event to a document node through the bound guest.
Sourcepub fn guest_mut(&mut self) -> Option<&mut G>
pub fn guest_mut(&mut self) -> Option<&mut G>
Mutably access the native guest owned by this document.
Sourcepub fn with_guest_mut<R>(
&mut self,
callback: impl FnOnce(&mut G, &mut BaseDocument) -> R,
) -> Result<R, String>
pub fn with_guest_mut<R>( &mut self, callback: impl FnOnce(&mut G, &mut BaseDocument) -> R, ) -> Result<R, String>
Run a closure with mutable access to the native guest.
pub fn pending_task_count(&self) -> u64
pub fn dispatch_dom_event(&mut self, event: DomEvent) -> Result<(), String>
pub fn handle_pointer_move_to_node( &mut self, event: BlitzPointerEvent, node: NodeId, ) -> Result<(), String>
pub fn handle_ui_event_to_node( &mut self, event: UiEvent, node: NodeId, ) -> Result<(), String>
pub fn set_ipc_handler( &mut self, handler: Box<dyn Fn(String)>, ) -> Result<(), String>
pub fn add_poll_hook(&mut self, hook: DocumentPollHook) -> Result<(), String>
Trait Implementations§
Source§impl<G, H> Document for RuntimeDriver<G, H>where
G: NativeDocumentRuntime,
H: NativeHost<Guest = G> + 'static,
impl<G, H> Document for RuntimeDriver<G, H>where
G: NativeDocumentRuntime,
H: NativeHost<Guest = G> + 'static,
fn inner(&self) -> DocGuard<'_>
fn inner_mut(&mut self) -> DocGuardMut<'_>
Source§fn handle_ui_event(&mut self, event: UiEvent)
fn handle_ui_event(&mut self, event: UiEvent)
Source§fn poll(&mut self, context: Option<Context<'_>>) -> bool
fn poll(&mut self, context: Option<Context<'_>>) -> bool
BaseDocumentSource§fn poll_for_settle(
&mut self,
context: Option<Context<'_>>,
run_timers: bool,
) -> bool
fn poll_for_settle( &mut self, context: Option<Context<'_>>, run_timers: bool, ) -> bool
Source§fn prepare_teardown(&mut self)
fn prepare_teardown(&mut self)
fn dispose(self: Box<Self>) -> Arc<Teardown> ⓘ
fn set_page_visible(&mut self, visible: bool)
fn freeze(&mut self)
fn finish_restore(&mut self)
fn resume(&mut self)
Auto Trait Implementations§
impl<G, H> !Freeze for RuntimeDriver<G, H>
impl<G, H> !RefUnwindSafe for RuntimeDriver<G, H>
impl<G, H> !Send for RuntimeDriver<G, H>
impl<G, H> !Sync for RuntimeDriver<G, H>
impl<G, H> !UnwindSafe for RuntimeDriver<G, H>
impl<G, H> Forget for RuntimeDriver<G, H>
impl<G, H> Move for RuntimeDriver<G, H>
impl<G, H> Unpin for RuntimeDriver<G, H>where
BoundScriptDocument<G, H>: Unpin,
impl<G, H> UnsafeUnpin for RuntimeDriver<G, H>where
BoundScriptDocument<G, H>: UnsafeUnpin,
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more