#[allow(unused_imports)]
use crate::old_impl::{
core::{Bhv, Status},
decor::*,
};
pub trait BhvExt: Bhv + Sized {
#[inline]
fn inv(self) -> Inv<Self> {
Inv(self)
}
#[inline]
fn pass(self) -> Pass<Self> {
Pass(self)
}
#[inline]
fn fail(self) -> Fail<Self> {
Fail(self)
}
#[inline]
fn run_if<C>(self, cond: C) -> RunIf<Self, C>
where
C: Fn(&Self::Context) -> bool,
{
RunIf {
bhv: self,
cond,
}
}
#[inline]
fn repeat(self, count: u32) -> Repeat<Self> {
Repeat {
bhv: self,
count,
current: 1,
}
}
#[inline]
fn repeat_until<C>(self, cond: C) -> RepeatUntil<Self, C>
where
C: Fn(&Self::Context) -> bool,
{
RepeatUntil {
bhv: self,
cond,
checked_cond: false,
}
}
#[inline]
fn repeat_until_pass(self) -> RepeatUntilPass<Self> {
RepeatUntilPass(self)
}
#[inline]
fn repeat_until_fail(self) -> RepeatUntilFail<Self> {
RepeatUntilFail(self)
}
}
impl<B> BhvExt for B where B: Bhv + Sized {}