Skip to main content

Document

Trait Document 

Source
pub trait Document: Any + 'static {
    // Required methods
    fn inner(&self) -> DocGuard<'_>;
    fn inner_mut(&mut self) -> DocGuardMut<'_>;

    // Provided methods
    fn handle_ui_event(&mut self, event: UiEvent) { ... }
    fn poll(&mut self, task_context: Option<Context<'_>>) -> bool { ... }
    fn poll_for_settle(
        &mut self,
        task_context: Option<Context<'_>>,
        run_timers: bool,
    ) -> bool { ... }
    fn id(&self) -> usize { ... }
}
Expand description

Abstraction over wrappers around BaseDocument to allow for them all to be driven by blitz-shell

Required Methods§

Source

fn inner(&self) -> DocGuard<'_>

Source

fn inner_mut(&mut self) -> DocGuardMut<'_>

Provided Methods§

Source

fn handle_ui_event(&mut self, event: UiEvent)

Update the Document in response to a UiEvent (click, keypress, etc)

Source

fn poll(&mut self, task_context: Option<Context<'_>>) -> bool

Poll any pending async operations, and flush changes to the underlying BaseDocument

Source

fn poll_for_settle( &mut self, task_context: Option<Context<'_>>, run_timers: bool, ) -> bool

Drain immediate work for a host’s settle loop.

Pass run_timers = true only on the first pass to allow one batch of due timer and animation callbacks. Subsequent passes must leave those callbacks scheduled while draining scripts and microtasks.

Documents that execute timers must override this method. Wrappers that poll child documents must propagate the policy to their children.

Source

fn id(&self) -> usize

Get the Document’s id

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Document for Rc<RefCell<BaseDocument>>

Source§

fn inner(&self) -> DocGuard<'_>

Source§

fn inner_mut(&mut self) -> DocGuardMut<'_>

Implementors§