[][src]Struct generations::Simulation

pub struct Simulation<Model, Step> { /* fields omitted */ }

A Simulation is a Generations instance combined with a stepping function. It allows you to repeatedly step through generations, using the same logic with each step.

It provides a step method, which advances the simulaton with the underlying stepper.

It is constructed with the Generations::with_rule method.

Methods

impl<Model, Step> Simulation<Model, Step>[src]

#[must_use] pub fn current(&self) -> &Model[src]

Return a reference to the current generation, which is the result of the most recent step, or the seed generation if no steps have been performed.

pub fn reset_with(&mut self, seeder: impl FnOnce(&mut Model))[src]

Replace the current generation with a new seed generation using a function. Has no effect on the existing scratch generation. The current generation is cleared before the seed function is called.

pub fn reset(&mut self, seed: Model)[src]

Replace the current generation with a new seed generation. Has no effect on the existing scratch generation.

pub fn unwrap(self) -> Generations<Model>[src]

Discard the stepping function and return the underlying Generations instance

impl<Model: Clone, Step> Simulation<Model, Step>[src]

pub fn reset_from(&mut self, seed: &Model)[src]

Replace the current generation with a clone of a new seed generation. Has no effect on the current scratch generation.

impl<Model, Step: FnMut(&Model, &mut Model)> Simulation<Model, Step>[src]

pub fn step(&mut self) -> &Model[src]

Step the simulation using the stored stepping function. Returns a reference to the previously current generation.

Trait Implementations

impl<Model: Debug, Step> Debug for Simulation<Model, Step>[src]

impl<Model, Step> AsRef<Generations<Model>> for Simulation<Model, Step>[src]

impl<Model: Clone, Step: Clone> Clone for Simulation<Model, Step>[src]

Auto Trait Implementations

impl<Model, Step> Unpin for Simulation<Model, Step> where
    Model: Unpin,
    Step: Unpin

impl<Model, Step> Send for Simulation<Model, Step> where
    Model: Send,
    Step: Send

impl<Model, Step> Sync for Simulation<Model, Step> where
    Model: Sync,
    Step: Sync

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]