Skip to main content

OutputAdapter

Trait OutputAdapter 

Source
pub trait OutputAdapter: Send + Sync {
    // Required methods
    fn print(&mut self, result: PrintResult) -> KindedSlot;
    fn clone_box(&self) -> Box<dyn OutputAdapter>;

    // Provided method
    fn print_content_html(&mut self, _html: String) { ... }
}
Expand description

Trait for handling print() output.

Different execution modes can provide different adapters:

Required Methods§

Source

fn print(&mut self, result: PrintResult) -> KindedSlot

Handle print() output.

Returns the value that print() yields. Scripts return KindedSlot::none(); REPL adapters MAY surface the PrintResult via a future typed-schema heap value but currently also return none() until that schema lands.

Source

fn clone_box(&self) -> Box<dyn OutputAdapter>

Clone the adapter (for trait object cloning)

Provided Methods§

Source

fn print_content_html(&mut self, _html: String)

Handle Content HTML from printing a Content value. Default implementation does nothing (terminal adapters don’t need HTML).

Trait Implementations§

Source§

impl Clone for Box<dyn OutputAdapter>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§