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: InteractivePrompt,
    ) -> Result<ReadResult, ShellError>;
    fn update_history(&mut self) -> Result<(), ShellError>;

    // Provided methods
    fn run_interactively(
        &mut self,
    ) -> impl Future<Output = Result<(), ShellError>> { ... }
    fn run_interactively_once(
        &mut self,
    ) -> impl Future<Output = Result<InteractiveExecutionResult, ShellError>> { ... }
}
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: InteractivePrompt, ) -> 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(&mut self) -> impl Future<Output = Result<(), ShellError>>

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( &mut self, ) -> impl Future<Output = Result<InteractiveExecutionResult, ShellError>>

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§