Trait libpt_cli::repl::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

Object Safety§

This trait is not object safe.

Implementors§