Skip to main content

Terminal

Trait Terminal 

Source
pub(crate) trait Terminal {
    // Required methods
    fn is_terminal(&self) -> bool;
    fn say(&mut self, line: &str);
    async fn ask(&mut self, prompt: &str, limit: Duration) -> Option<String>;
    async fn open_browser(&mut self, url: &str) -> bool;
}
Expand description

The person’s terminal.

Required Methods§

Source

fn is_terminal(&self) -> bool

Source

fn say(&mut self, line: &str)

Source

async fn ask(&mut self, prompt: &str, limit: Duration) -> Option<String>

One line the person types, or None at the time limit, at the end of input or on Ctrl-C.

Source

async fn open_browser(&mut self, url: &str) -> bool

Open the browser at url; false when none could be opened. It waits a moment to see whether the program stayed, so it is async: it must not hold up the runtime’s thread while the terminal’s other work (the timer, Ctrl-C) waits.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§