Genetic-rs 1.3.0
A small QoL/bugfix update. Here's a list of changes:
- New
FitnessObserverlayering API. Allows you to chainFitnessObserversviafoo.layer(bar).layer(...) - Many of the
GeneticSim-owned traits of the crate, includingFitnessObserver,Eliminator, andRepopulator, now take&mut selfinstead of&self. This should make it more convenient to deal with internal state. - doc-related fix that should make feature doc badges generate automatically.
Migration Guide
In any FitnessObserver, Eliminator, or Repopulator, you must now replace any &self with &mut self:
impl FitnessObserver<MyGenome> for Foo {
- fn observe(&self, genomes: &[(MyGenome, f32)])
+ fn observe(&mut self, genomes: &[(MyGenome, f32)])
{
// ...
}
}
impl<G> Eliminator<G> for Bar {
- fn eliminate(&self, genomes: Vec<G>) -> Vec<G>
+ fn eliminate(&mut self, genomes: Vec<G>) -> Vec<G>
{
// ...
}
}
impl<G> Repopulate<G> for Buzz {
- fn repopulate(&self, genomes: &mut Vec<G>, target_size: usize)
+ fn repopulate(&mut self, genomes: &mut Vec<G>, target_size: usize)
{
// ...
}
}What's Changed
- Add observer layering API via
LayeredObserverandFitnessObserver::layerby @Copilot in #135 - Fix feature docs not showing up on docs.rs by @Copilot in #136
- Allow
FitnessObserver::observeandRepopulator::repopulateto take&mut selfby @Copilot in #139 - Update 1.3.0 by @HyperCodec in #137
Full Changelog: 1.2.2...1.3.0