Struct rpn_cli::helper::CommandHelper
source · pub struct CommandHelper { /* private fields */ }Implementations§
source§impl CommandHelper
impl CommandHelper
pub fn new() -> CommandHelper
pub fn set_commands(&mut self, commands: Vec<String>)
pub fn set_completions(&mut self, completions: HashMap<String, Completion>)
Trait Implementations§
source§impl Completer for CommandHelper
impl Completer for CommandHelper
source§impl Highlighter for CommandHelper
impl Highlighter for CommandHelper
source§fn highlight<'l>(&self, line: &'l str, pos: usize) -> Cow<'l, str>
fn highlight<'l>(&self, line: &'l str, pos: usize) -> Cow<'l, str>
Takes the currently edited
line with the cursor position and
returns the highlighted version (with ANSI color). Read moresource§fn highlight_prompt<'b, 's, 'p>(
&'s self,
prompt: &'p str,
default: bool
) -> Cow<'b, str>where
's: 'b,
'p: 'b,
fn highlight_prompt<'b, 's, 'p>(
&'s self,
prompt: &'p str,
default: bool
) -> Cow<'b, str>where
's: 'b,
'p: 'b,
Takes the
prompt and
returns the highlighted version (with ANSI color).source§fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str>
fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str>
Takes the
hint and
returns the highlighted version (with ANSI color).source§fn highlight_candidate<'c>(
&self,
candidate: &'c str,
completion: CompletionType
) -> Cow<'c, str>
fn highlight_candidate<'c>( &self, candidate: &'c str, completion: CompletionType ) -> Cow<'c, str>
Takes the completion
candidate and
returns the highlighted version (with ANSI color). Read moresource§impl Hinter for CommandHelper
impl Hinter for CommandHelper
source§impl Validator for CommandHelper
impl Validator for CommandHelper
source§fn validate(
&self,
ctx: &mut ValidationContext<'_>
) -> Result<ValidationResult, ReadlineError>
fn validate( &self, ctx: &mut ValidationContext<'_> ) -> Result<ValidationResult, ReadlineError>
Takes the currently edited
input and returns a
ValidationResult indicating whether it is valid or not along
with an option message to display about the result. The most
common validity check to implement is probably whether the
input is complete or not, for instance ensuring that all
delimiters are fully balanced. Read moresource§fn validate_while_typing(&self) -> bool
fn validate_while_typing(&self) -> bool
Configure whether validation is performed while typing or only
when user presses the Enter key. Read more
impl Helper for CommandHelper
Auto Trait Implementations§
impl Freeze for CommandHelper
impl RefUnwindSafe for CommandHelper
impl Send for CommandHelper
impl Sync for CommandHelper
impl Unpin for CommandHelper
impl UnwindSafe for CommandHelper
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more