1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use super::options::MutConfig;
type Mut = Box<Mutation + Send + Sync>;
pub trait Mutation : std::fmt::Display + std::fmt::Debug + MutationClone{
fn configure(&mut self, config: Box<&dyn MutConfig>);
fn mutate(&mut self, data : &mut [u8]);
}
pub trait MutationClone {
fn clone_box(&self) -> Mut;
}
impl<T> MutationClone for T where
T: 'static + Mutation + Clone + Send + Sync {
fn clone_box(&self) -> Mut {
Box::new(self.clone())
}
}
impl Clone for Mut {
fn clone(&self) -> Self {
self.clone_box()
}
}