Gene refactor

This commit is contained in:
rendo 2026-04-01 15:58:12 +05:00
commit 5abbbc3bf9
8 changed files with 114 additions and 106 deletions

View file

@ -0,0 +1,34 @@
use std::fmt::Display;
pub mod gene_types;
pub mod gene_place;
pub mod gene_source;
pub use gene_types::GeneType;
pub use gene_source::GeneSource;
pub use gene_place::GenePlace;
#[derive(PartialEq,Eq,Clone)]
pub struct Gene {
pub plant_source: GeneSource,
pub place: GenePlace,
pub kind: GeneType
}
impl Gene {
pub fn new(plant_source: GeneSource, place: GenePlace, kind: GeneType) -> Self {
Self {
plant_source,
place,
kind,
}
}
}
impl Display for Gene {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f,"({}) {}",self.plant_source,self.place)
}
}