Skip to main content

Runner

Trait Runner 

Source
pub trait Runner {
    // Required method
    fn run(&self, source: &str) -> Result<AnyView, Vec<CodeDiagnostic>>;

    // Provided methods
    fn take_output(&self) -> RunOutput { ... }
    fn watch(&self, wake: Rc<dyn Fn()>) { ... }
}
Expand description

What turns the code of a Playground into something to show.

It runs when the person asks, never on every frame, so it may take its time and build whatever it needs anew.

Required Methods§

Source

fn run(&self, source: &str) -> Result<AnyView, Vec<CodeDiagnostic>>

The view source makes, or where and why it cannot make one.

Provided Methods§

Source

fn take_output(&self) -> RunOutput

What the code printed, and the problems of what it runs later, such as a closure on a click, since the last time this was asked. Nothing, unless the runner keeps them.

Source

fn watch(&self, wake: Rc<dyn Fn()>)

Calls wake whenever there is something new for Self::take_output, so the playground shows it as it comes. Nothing, unless the runner can tell.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§