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§
Sourcefn shell(&self) -> impl AsRef<Shell> + Send
fn shell(&self) -> impl AsRef<Shell> + Send
Returns an immutable reference to the inner shell object.
Sourcefn shell_mut(&mut self) -> impl AsMut<Shell> + Send
fn shell_mut(&mut self) -> impl AsMut<Shell> + Send
Returns a mutable reference to the inner shell object.
Sourcefn read_line(
&mut self,
prompt: InteractivePrompt,
) -> Result<ReadResult, ShellError>
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.
Sourcefn update_history(&mut self) -> Result<(), ShellError>
fn update_history(&mut self) -> Result<(), ShellError>
Update history, if relevant.
Provided Methods§
Sourcefn run_interactively(&mut self) -> impl Future<Output = Result<(), ShellError>>
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.
Sourcefn run_interactively_once(
&mut self,
) -> impl Future<Output = Result<InteractiveExecutionResult, ShellError>>
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.