use crate::{
core::{
convert::TryFromInput,
handler::Handler,
predicate::{base::Predicate, command::CommandPredicate},
},
types::Command,
};
pub trait PredicateExt<P, PI, HI>: Sized {
fn with_predicate(self, predicate: P) -> Predicate<P, PI, Self, HI> {
Predicate::new(predicate, self)
}
}
impl<P, PI, H, HI> PredicateExt<P, PI, HI> for H
where
H: Handler<HI>,
HI: TryFromInput,
{
}
pub trait CommandExt<I>: Sized {
fn with_command<S: Into<String>>(self, name: S) -> Predicate<CommandPredicate, Command, Self, I> {
Predicate::new(CommandPredicate::new(name), self)
}
}
impl<H, I> CommandExt<I> for H
where
H: Handler<I>,
I: TryFromInput,
{
}