pub trait Repl<C>: Parser + Debug{
// Required methods
fn new() -> Self;
fn command(&self) -> &Option<C>;
fn step(&mut self) -> Result<(), Error>;
}
Expand description
Common Trait for repl objects
Unless you want to implement custom features (not just commands), just use DefaultRepl
.
Required Methods§
Sourcefn step(&mut self) -> Result<(), Error>
fn step(&mut self) -> Result<(), Error>
advance the repl to the next iteration of the main loop
This should be used at the start of your loop.
Note that the help menu is an Error: clap::error::ErrorKind::DisplayHelp
§Errors
Error::Input
– dialoguer User Input had some kind of I/O ErrorError::Parsing
– clap could not parse the user input, or user requested helpError::Other
– Any other error with anyhow,DefaultRepl
does not use this but custom implementations might
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.