Skip to main content

LineDriver

Trait LineDriver 

Source
pub trait LineDriver: Send + Sync {
    // Required methods
    fn read_line(&mut self, cx: &mut Cx, prompt: &str) -> Result<Option<String>>;
    fn write_output(&mut self, cx: &mut Cx, output: &str) -> Result<()>;

    // Provided methods
    fn supports_multiline(&self) -> bool { ... }
    fn capabilities(&self) -> &[CapabilityName] { ... }
}
Expand description

Source of REPL input lines and sink for rendered output.

Required Methods§

Source

fn read_line(&mut self, cx: &mut Cx, prompt: &str) -> Result<Option<String>>

Reads the next input line, showing prompt; returns None at end of input.

Source

fn write_output(&mut self, cx: &mut Cx, output: &str) -> Result<()>

Writes rendered output to the driver.

Provided Methods§

Source

fn supports_multiline(&self) -> bool

Reports whether the driver reads multi-line input. Defaults to false.

Source

fn capabilities(&self) -> &[CapabilityName]

Returns the capabilities the driver requires. Defaults to none.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§