pub struct Gene {
pub num_markers: u16,
pub markers: Vec<Marker>,
}
Fields§
§num_markers: u16
§markers: Vec<Marker>
Implementations§
source§impl Gene
impl Gene
First marker is influence
sourcepub fn is_equal(left_gene: &Gene, right_gene: &Gene) -> bool
pub fn is_equal(left_gene: &Gene, right_gene: &Gene) -> bool
Compare is two gene is equal
§Examples
use genome::Gene;
let gene1 = Gene::new(2);
let gene2 = Gene::new(2);
let is_equal = Gene::is_equal(&gene1, &gene2);
sourcepub fn get_influence(&self) -> f32
pub fn get_influence(&self) -> f32
Get influence for this gene
§Examples
use genome::Gene;
let gene1 = Gene::new(2);
let influence = gene1.get_influence();
sourcepub fn get_marker(&self, position: usize) -> Option<f32>
pub fn get_marker(&self, position: usize) -> Option<f32>
Get markers at position for the gene, ignore influence
§Examples
use genome::Gene;
let gene1 = Gene::new(2);
let marker = gene1.get_marker(0);
sourcepub fn get_markers(&self) -> Vec<f32>
pub fn get_markers(&self) -> Vec<f32>
Get all markers for the gene, ignore influence
§Examples
use genome::Gene;
let gene1 = Gene::new(2);
let markers = gene1.get_markers();
sourcepub fn to_string(&self) -> String
pub fn to_string(&self) -> String
Convert gene to string
§Examples
use genome::Gene;
let gene1 = Gene::new(2);
let gene_str = gene1.to_string();
sourcepub fn compare(left_gene: Gene, right_gene: Gene) -> bool
pub fn compare(left_gene: Gene, right_gene: Gene) -> bool
Compare gene for equality
§Examples
use genome::Gene;
let gene1 = Gene::new(2);
let gene2 = Gene::new(2);
let is_same = Gene::compare(gene1, gene2);
Trait Implementations§
source§impl From<Gene> for String
impl From<Gene> for String
Convert gene to string
§Examples
use genome::Gene;
let gene1 = Gene::new(2);
let gene_str = String::from(gene1);
source§impl From<String> for Gene
impl From<String> for Gene
Convert string to Gene
§Examples
use genome::Gene;
let gene1 = Gene::new(2);
let gene_str = String::from(gene1);
let gene_copy = Gene::from(gene_str);
Auto Trait Implementations§
impl RefUnwindSafe for Gene
impl Send for Gene
impl Sync for Gene
impl Unpin for Gene
impl UnwindSafe for Gene
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more