pub struct Repl<Context, E: Display> { /* private fields */ }
Expand description
Main REPL struct
Implementations§
source§impl<Context, E> Repl<Context, E>where
E: Display + From<Error>,
impl<Context, E> Repl<Context, E>where E: Display + From<Error>,
sourcepub fn with_name(self, name: &str) -> Self
pub fn with_name(self, name: &str) -> Self
Give your Repl a name. This is used in the help summary for the Repl.
sourcepub fn with_version(self, version: &str) -> Self
pub fn with_version(self, version: &str) -> Self
Give your Repl a version. This is used in the help summary for the Repl.
sourcepub fn with_description(self, description: &str) -> Self
pub fn with_description(self, description: &str) -> Self
Give your Repl a description. This is used in the help summary for the Repl.
sourcepub fn with_prompt(self, prompt: &'static dyn Display) -> Self
pub fn with_prompt(self, prompt: &'static dyn Display) -> Self
Give your Repl a custom prompt. The default prompt is the Repl name, followed by
a >
, all in green, followed by a space.
sourcepub fn with_help_viewer<V: 'static + HelpViewer>(self, help_viewer: V) -> Self
pub fn with_help_viewer<V: 'static + HelpViewer>(self, help_viewer: V) -> Self
Pass in a custom help viewer
sourcepub fn with_error_handler(
self,
handler: fn(error: E, repl: &Repl<Context, E>) -> Result<()>
) -> Self
pub fn with_error_handler( self, handler: fn(error: E, repl: &Repl<Context, E>) -> Result<()> ) -> Self
Pass in a custom error handler. This is really only for testing - the default error handler simply prints the error to stderr and then returns
sourcepub fn use_completion(self, value: bool) -> Self
pub fn use_completion(self, value: bool) -> Self
Set whether to use command completion when tab is hit. Defaults to false.
sourcepub fn add_command(self, command: Command<Context, E>) -> Self
pub fn add_command(self, command: Command<Context, E>) -> Self
Add a command to your REPL
pub fn run(&mut self) -> Result<()>
Auto Trait Implementations§
impl<Context, E> !RefUnwindSafe for Repl<Context, E>
impl<Context, E> !Send for Repl<Context, E>
impl<Context, E> !Sync for Repl<Context, E>
impl<Context, E> Unpin for Repl<Context, E>where Context: Unpin,
impl<Context, E> !UnwindSafe for Repl<Context, E>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more