Skip to main content

PermutationGenome

Trait PermutationGenome 

Source
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§

Source

fn permutation(&self) -> &[usize]

Get the permutation as a slice

Source

fn permutation_mut(&mut self) -> &mut [usize]

Get the permutation as a mutable slice

Source

fn from_permutation(perm: Vec<usize>) -> Result<Self, GenomeError>

Create from a vector of indices

Provided Methods§

Source

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.

Implementors§