fix executor post exec
This commit is contained in:
parent
95afa0966d
commit
0a4a40101a
@ -9,7 +9,7 @@ use core::cmp::PartialEq;
|
|||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bolts::tuples::{MatchNameAndType, MatchType, Named, TupleList},
|
bolts::tuples::{Named},
|
||||||
events::EventManager,
|
events::EventManager,
|
||||||
inputs::{HasTargetBytes, Input},
|
inputs::{HasTargetBytes, Input},
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
@ -78,8 +78,8 @@ pub trait Executor<I>: Named
|
|||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
{
|
{
|
||||||
#[inline]
|
|
||||||
/// Called right before exexution starts
|
/// Called right before exexution starts
|
||||||
|
#[inline]
|
||||||
fn pre_exec<EM, S>(
|
fn pre_exec<EM, S>(
|
||||||
&mut self,
|
&mut self,
|
||||||
_state: &mut S,
|
_state: &mut S,
|
||||||
@ -92,8 +92,8 @@ where
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
/// Called right after execution finished.
|
/// Called right after execution finished.
|
||||||
|
#[inline]
|
||||||
fn post_exec<EM, S>(&mut self, _state: &S, _event_mgr: &mut EM, _input: &I) -> Result<(), Error>
|
fn post_exec<EM, S>(&mut self, _state: &S, _event_mgr: &mut EM, _input: &I) -> Result<(), Error>
|
||||||
where
|
where
|
||||||
EM: EventManager<I, S>,
|
EM: EventManager<I, S>,
|
||||||
@ -105,39 +105,6 @@ where
|
|||||||
fn run_target(&mut self, input: &I) -> Result<ExitKind, Error>;
|
fn run_target(&mut self, input: &I) -> Result<ExitKind, Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ExecutorsTuple<I>: MatchType + MatchNameAndType
|
|
||||||
where
|
|
||||||
I: Input,
|
|
||||||
{
|
|
||||||
//fn for_each(&self, f: fn(&dyn Executor<I>));
|
|
||||||
//fn for_each_mut(&mut self, f: fn(&mut dyn Executor<I>));
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<I> ExecutorsTuple<I> for ()
|
|
||||||
where
|
|
||||||
I: Input,
|
|
||||||
{
|
|
||||||
//fn for_each(&self, _f: fn(&dyn Executor<I>)) {}
|
|
||||||
//fn for_each_mut(&mut self, _f: fn(&mut dyn Executor<I>)) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<Head, Tail, I> ExecutorsTuple<I> for (Head, Tail)
|
|
||||||
where
|
|
||||||
Head: Executor<I> + 'static,
|
|
||||||
Tail: ExecutorsTuple<I> + TupleList,
|
|
||||||
I: Input,
|
|
||||||
{
|
|
||||||
/*fn for_each(&self, f: fn(&dyn Executor<I>)) {
|
|
||||||
f(&self.0);
|
|
||||||
self.1.for_each(f)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn for_each_mut(&mut self, f: fn(&mut dyn Executor<I>)) {
|
|
||||||
f(&mut self.0);
|
|
||||||
self.1.for_each_mut(f)
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
|
@ -647,7 +647,7 @@ where
|
|||||||
|
|
||||||
executor.pre_exec(self, event_mgr, input)?;
|
executor.pre_exec(self, event_mgr, input)?;
|
||||||
let exit_kind = executor.run_target(input)?;
|
let exit_kind = executor.run_target(input)?;
|
||||||
//executor.post_exec(&self, event_mgr, input)?;
|
executor.post_exec(self, event_mgr, input)?;
|
||||||
|
|
||||||
*self.executions_mut() += 1;
|
*self.executions_mut() += 1;
|
||||||
executor.post_exec_observers()?;
|
executor.post_exec_observers()?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user