[−][src]Struct generations::Simulation
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: Clearable, Step: FnMut(&Model, &mut Model)> 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 step(&mut self) -> &Model
[src]
Step the simulation using the stored stepping function. Returns a reference to the previously current generation.
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
Trait Implementations
impl<Model: Clone + Clearable, Step: Clone + FnMut(&Model, &mut Model)> Clone for Simulation<Model, Step>
[src]
fn clone(&self) -> Simulation<Model, Step>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Model: Clearable, Step: FnMut(&Model, &mut Model)> AsRef<Generations<Model>> for Simulation<Model, Step>
[src]
fn as_ref(&self) -> &Generations<Model>
[src]
impl<Model: Debug + Clearable, Step: FnMut(&Model, &mut Model)> Debug for Simulation<Model, Step>
[src]
Auto Trait Implementations
impl<Model, Step> Send for Simulation<Model, Step> where
Model: Send,
Step: Send,
Model: Send,
Step: Send,
impl<Model, Step> Unpin for Simulation<Model, Step> where
Model: Unpin,
Step: Unpin,
Model: Unpin,
Step: Unpin,
impl<Model, Step> Sync for Simulation<Model, Step> where
Model: Sync,
Step: Sync,
Model: Sync,
Step: Sync,
impl<Model, Step> UnwindSafe for Simulation<Model, Step> where
Model: UnwindSafe,
Step: UnwindSafe,
Model: UnwindSafe,
Step: UnwindSafe,
impl<Model, Step> RefUnwindSafe for Simulation<Model, Step> where
Model: RefUnwindSafe,
Step: RefUnwindSafe,
Model: RefUnwindSafe,
Step: RefUnwindSafe,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,