Struct easy_repl::repl::ReplBuilder [−][src]
pub struct ReplBuilder<'a> { /* fields omitted */ }Expand description
Builder pattern implementation for Repl.
All setter methods take owned self so the calls can be chained, for example:
let repl = Repl::builder() .description("My REPL") .prompt("repl> ") .build() .expect("Failed to build REPL");
Implementations
impl<'a> ReplBuilder<'a>[src]
impl<'a> ReplBuilder<'a>[src]pub fn description<T: Into<String>>(self, v: T) -> Self[src]
pub fn description<T: Into<String>>(self, v: T) -> Self[src]Repl description shown in Repl::help. Defaults to an empty string.
pub fn text_width<T: Into<usize>>(self, v: T) -> Self[src]
pub fn text_width<T: Into<usize>>(self, v: T) -> Self[src]Width of the text used when wrapping the help message. Defaults to 80.
pub fn editor_config<T: Into<Config>>(self, v: T) -> Self[src]
pub fn editor_config<T: Into<Config>>(self, v: T) -> Self[src]Configuration for rustyline. Some sane defaults are used.
pub fn out<T: Into<Box<dyn Write>>>(self, v: T) -> Self[src]
pub fn out<T: Into<Box<dyn Write>>>(self, v: T) -> Self[src]Where to print REPL output. By default std::io::Stderr is used.
Note that rustyline will always use std::io::Stderr or std::io::Stdout.
These must be configured in ReplBuilder::editor_config, and currently there seems to be no way
to use other output stream for rustyline (which probably also makes little sense).
pub fn with_hints<T: Into<bool>>(self, v: T) -> Self[src]
pub fn with_hints<T: Into<bool>>(self, v: T) -> Self[src]Print command hints. Defaults to true.
Hints will show the end of a command if there is only one avaliable.
For example, assuming commands "move" and "make", in the following position (|
indicates the cursor):
> mo|
a hint will be shown as
> mo|ve
but when there is only
> m|
then no hints will be shown.
pub fn with_completion<T: Into<bool>>(self, v: T) -> Self[src]
pub fn with_completion<T: Into<bool>>(self, v: T) -> Self[src]Use completion. Defaults to true.
pub fn with_filename_completion<T: Into<bool>>(self, v: T) -> Self[src]
pub fn with_filename_completion<T: Into<bool>>(self, v: T) -> Self[src]Add filename completion, besides command completion. Defaults to false.
pub fn predict_commands<T: Into<bool>>(self, v: T) -> Self[src]
pub fn predict_commands<T: Into<bool>>(self, v: T) -> Self[src]Execute commands when entering incomplete names. Defaults to true.
With this option commands can be executed by entering only part of command name.
If there is only a single command mathing given prefix, then it will be executed.
For example, with commands "make" and “move”, entering just mo will resolve
to move and the command will be executed, but entering m will result in an error.
pub fn add(self, name: &str, cmd: Command<'a>) -> Self[src]
pub fn add(self, name: &str, cmd: Command<'a>) -> Self[src]Add a command with given name. Use along with the command! macro.
pub fn build(self) -> Result<Repl<'a>, BuilderError>[src]
pub fn build(self) -> Result<Repl<'a>, BuilderError>[src]Finalize the configuration and return the REPL or error.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for ReplBuilder<'a>
impl<'a> !Send for ReplBuilder<'a>
impl<'a> !Sync for ReplBuilder<'a>
impl<'a> Unpin for ReplBuilder<'a>
impl<'a> !UnwindSafe for ReplBuilder<'a>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T