Construct Commands

This commit is contained in:
Joscha 2023-01-24 15:26:11 +01:00
parent ec9c4c9dd4
commit 5655fa7c4a

View file

@ -58,6 +58,14 @@ pub struct Commands<B, E> {
} }
impl<B, E> 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 /// Global commands always respond. They override any specific or general
/// commands of the same name. /// 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)] #[cfg(test)]
mod test { mod test {
use super::{parse_command, parse_specific}; use super::{parse_command, parse_specific};