1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use std::io;
use crate::command::Category;
use crate::prompter::Prompter;
use crate::terminal::Terminal;
pub trait Function<Term: Terminal>: Send + Sync {
fn execute(&self, prompter: &mut Prompter<Term>, count: i32, ch: char) -> io::Result<()>;
fn category(&self) -> Category { Category::Other }
}
impl<F, Term: Terminal> Function<Term> for F where
F: Send + Sync,
F: Fn(&mut Prompter<Term>, i32, char) -> io::Result<()> {
fn execute(&self, prompter: &mut Prompter<Term>, count: i32, ch: char) -> io::Result<()> {
self(prompter, count, ch)
}
}