fix executor post exec

This commit is contained in:
Andrea Fioraldi 2021-03-05 14:19:17 +01:00
parent 95afa0966d
commit 0a4a40101a
2 changed files with 4 additions and 37 deletions

View File

@ -9,7 +9,7 @@ use core::cmp::PartialEq;
use core::marker::PhantomData;
use crate::{
bolts::tuples::{MatchNameAndType, MatchType, Named, TupleList},
bolts::tuples::{Named},
events::EventManager,
inputs::{HasTargetBytes, Input},
observers::ObserversTuple,
@ -78,8 +78,8 @@ pub trait Executor<I>: Named
where
I: Input,
{
#[inline]
/// Called right before exexution starts
#[inline]
fn pre_exec<EM, S>(
&mut self,
_state: &mut S,
@ -92,8 +92,8 @@ where
Ok(())
}
#[inline]
/// Called right after execution finished.
#[inline]
fn post_exec<EM, S>(&mut self, _state: &S, _event_mgr: &mut EM, _input: &I) -> Result<(), Error>
where
EM: EventManager<I, S>,
@ -105,39 +105,6 @@ where
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)]
mod test {
use core::marker::PhantomData;

View File

@ -647,7 +647,7 @@ where
executor.pre_exec(self, event_mgr, 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;
executor.post_exec_observers()?;