use crate::{core::handler::Handler, types::Command};
#[cfg(test)]
mod tests;
#[derive(Clone)]
pub struct CommandPredicate {
name: String,
}
impl CommandPredicate {
pub fn new<S: Into<String>>(name: S) -> Self {
Self { name: name.into() }
}
}
impl Handler<Command> for CommandPredicate {
type Output = bool;
async fn handle(&self, input: Command) -> Self::Output {
input.get_name() == self.name
}
}