Trait Repl

Source
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§

Source

fn new() -> Self

create a new repl

Source

fn command(&self) -> &Option<C>

get the command that was parsed from user input

Will only be None if the repl has not had step executed yet.

Source

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

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§