Construct Commands
This commit is contained in:
parent
ec9c4c9dd4
commit
5655fa7c4a
1 changed files with 14 additions and 0 deletions
|
|
@ -58,6 +58,14 @@ pub struct Commands<B, E> {
|
|||
}
|
||||
|
||||
impl<B, E> Commands<B, E> {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
global: HashMap::new(),
|
||||
general: HashMap::new(),
|
||||
specific: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Global commands always respond. They override any specific or general
|
||||
/// commands of the same name.
|
||||
///
|
||||
|
|
@ -209,6 +217,12 @@ impl<B, E> Commands<B, E> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<B, E> Default for Commands<B, E> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::{parse_command, parse_specific};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue