Trait Function

Source
pub trait Function<Term: Terminal>: Send + Sync {
    // Required method
    fn execute(
        &self,
        prompter: &mut Prompter<'_, '_, Term>,
        count: i32,
        ch: char,
    ) -> Result<()>;

    // Provided method
    fn category(&self) -> Category { ... }
}
Expand description

Implements custom functionality for a Prompter command

Required Methods§

Source

fn execute( &self, prompter: &mut Prompter<'_, '_, Term>, count: i32, ch: char, ) -> Result<()>

Executes the function.

count is the numerical argument supplied by the user; 1 by default. prompter.explicit_arg() may be called to determine whether this value was explicitly supplied by the user.

ch is the final character of the sequence that triggered the command. prompter.sequence() may be called to determine the full sequence that triggered the command.

Provided Methods§

Source

fn category(&self) -> Category

Returns the command category.

Implementors§

Source§

impl<F, Term: Terminal> Function<Term> for F
where F: Send + Sync + Fn(&mut Prompter<'_, '_, Term>, i32, char) -> Result<()>,