Simplified eq of gene types
This commit is contained in:
parent
219fc97519
commit
c50cd54925
1 changed files with 18 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use crate::genetics::flow::Flow;
|
||||
|
||||
/// GeneType is an enum that defines behaviour of gene.
|
||||
#[derive(PartialEq,Eq,Clone)]
|
||||
#[derive(Clone)]
|
||||
pub enum GeneType {
|
||||
/// Without functional behaviour. Doesn't pass through flow.
|
||||
Structural,
|
||||
|
|
@ -94,3 +94,20 @@ impl GeneType {
|
|||
ChildDistribution::All
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for GeneType {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(Self::PureProducer { create_flow: _ }, Self::PureProducer { create_flow: _ }) => true,
|
||||
(Self::Producer { create_flow: _, modify_single: _, modify_all: _, decide_modification_type: _ }, Self::Producer { create_flow: _, modify_single: _, modify_all: _, decide_modification_type: _ }) => true,
|
||||
(Self::Transport { distribute_between_children: _ }, Self::Transport { distribute_between_children: _ }) => true,
|
||||
(Self::Consumer { consume: _ }, Self::Consumer { consume: _ }) => true,
|
||||
(Self::Modifier { modify_flow: _ }, Self::Modifier { modify_flow: _ }) => true,
|
||||
(Self::Trigger { check_trigger: _, distribute_between_children: _ }, Self::Trigger { check_trigger: _, distribute_between_children: _ }) => true,
|
||||
(Self::Observer { observe: _, distribute_between_children: _ }, Self::Observer { observe: _, distribute_between_children: _ }) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for GeneType {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue