pub trait PermutationGenome: EvolutionaryGenome<Allele = usize> {
// Required methods
fn permutation(&self) -> &[usize];
fn permutation_mut(&mut self) -> &mut [usize];
fn from_permutation(perm: Vec<usize>) -> Result<Self, GenomeError>;
// Provided method
fn is_valid_permutation(&self) -> bool { ... }
}Expand description
Trait for genomes that represent permutations
Required Methods§
Sourcefn permutation(&self) -> &[usize]
fn permutation(&self) -> &[usize]
Get the permutation as a slice
Sourcefn permutation_mut(&mut self) -> &mut [usize]
fn permutation_mut(&mut self) -> &mut [usize]
Get the permutation as a mutable slice
Sourcefn from_permutation(perm: Vec<usize>) -> Result<Self, GenomeError>
fn from_permutation(perm: Vec<usize>) -> Result<Self, GenomeError>
Create from a vector of indices
Provided Methods§
Sourcefn is_valid_permutation(&self) -> bool
fn is_valid_permutation(&self) -> bool
Check if the genome represents a valid permutation
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.