pub trait BinaryGenome: EvolutionaryGenome<Allele = bool> {
// Required methods
fn bits(&self) -> &[bool];
fn bits_mut(&mut self) -> &mut [bool];
fn from_bits(bits: Vec<bool>) -> Result<Self, GenomeError>;
// Provided methods
fn count_ones(&self) -> usize { ... }
fn count_zeros(&self) -> usize { ... }
}Expand description
Trait for genomes that can be represented as bit strings
Required Methods§
Provided Methods§
Sourcefn count_ones(&self) -> usize
fn count_ones(&self) -> usize
Count the number of true bits (ones)
Sourcefn count_zeros(&self) -> usize
fn count_zeros(&self) -> usize
Count the number of false bits (zeros)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.