brush_interactive

Trait InteractiveShell

source
pub trait InteractiveShell {
    // Required methods
    fn shell(&self) -> impl AsRef<Shell> + Send;
    fn shell_mut(&mut self) -> impl AsMut<Shell> + Send;
    fn read_line(&mut self, prompt: &str) -> Result<ReadResult, ShellError>;
    fn update_history(&mut self) -> Result<(), ShellError>;

    // Provided methods
    fn run_interactively<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), ShellError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn run_interactively_once<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<InteractiveExecutionResult, ShellError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Represents a shell capable of taking commands from standard input.

Required Methods§

source

fn shell(&self) -> impl AsRef<Shell> + Send

Returns an immutable reference to the inner shell object.

source

fn shell_mut(&mut self) -> impl AsMut<Shell> + Send

Returns a mutable reference to the inner shell object.

source

fn read_line(&mut self, prompt: &str) -> Result<ReadResult, ShellError>

Reads a line of input, using the given prompt.

§Arguments
  • prompt - The prompt to display to the user.
source

fn update_history(&mut self) -> Result<(), ShellError>

Update history, if relevant.

Provided Methods§

source

fn run_interactively<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), ShellError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Runs the interactive shell loop, reading commands from standard input and writing results to standard output and standard error. Continues until the shell normally exits or until a fatal error occurs.

source

fn run_interactively_once<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<InteractiveExecutionResult, ShellError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Runs the interactive shell loop once, reading a single command from standard input.

Object Safety§

This trait is not object safe.

Implementors§