Skip to main content

Weighted

Struct Weighted 

Source
pub struct Weighted<O: ?Sized>(/* private fields */);
Expand description

Selects one operator per invocation based on assigned weights.

Each operator is paired with a NonZero<u16> weight. On each call, a random roll determines which operator runs. Higher weights mean higher probability.

Accepts a tuple of up to 16 (Operator, NonZero<u16>) pairs.

§Examples

use evolve::operators::sequential::combinator::Weighted;
use evolve::operators::sequential::mutation::RandomReset;
use std::num::NonZero;

// 75% chance of first operator, 25% chance of second
let op = Weighted::new((
    (RandomReset::<u8>::new(), NonZero::new(3u16).unwrap()),
    (RandomReset::<u8>::new(), NonZero::new(1u16).unwrap()),
));

Implementations§

Source§

impl<O> Weighted<O>

Source

pub fn new(operators: O) -> Self

Creates a new Weighted from a tuple of (operator, weight) pairs.

Trait Implementations§

Source§

impl<O: Clone + ?Sized> Clone for Weighted<O>

Source§

fn clone(&self) -> Weighted<O>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<O: Debug + ?Sized> Debug for Weighted<O>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<G, F, Fe, R, C, O> GeneticOperator<G, F, Fe, R, C> for Weighted<[(O, NonZero<u16>)]>
where O: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O1, NonZero<u16>), (O2, NonZero<u16>), (O3, NonZero<u16>), (O4, NonZero<u16>), (O5, NonZero<u16>), (O6, NonZero<u16>), (O7, NonZero<u16>), (O8, NonZero<u16>), (O9, NonZero<u16>), (O10, NonZero<u16>), (O11, NonZero<u16>), (O12, NonZero<u16>), (O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O1: GeneticOperator<G, F, Fe, R, C>, O2: GeneticOperator<G, F, Fe, R, C>, O3: GeneticOperator<G, F, Fe, R, C>, O4: GeneticOperator<G, F, Fe, R, C>, O5: GeneticOperator<G, F, Fe, R, C>, O6: GeneticOperator<G, F, Fe, R, C>, O7: GeneticOperator<G, F, Fe, R, C>, O8: GeneticOperator<G, F, Fe, R, C>, O9: GeneticOperator<G, F, Fe, R, C>, O10: GeneticOperator<G, F, Fe, R, C>, O11: GeneticOperator<G, F, Fe, R, C>, O12: GeneticOperator<G, F, Fe, R, C>, O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O10, O11, O12, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O10, NonZero<u16>), (O11, NonZero<u16>), (O12, NonZero<u16>), (O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O10: GeneticOperator<G, F, Fe, R, C>, O11: GeneticOperator<G, F, Fe, R, C>, O12: GeneticOperator<G, F, Fe, R, C>, O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O11, O12, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O11, NonZero<u16>), (O12, NonZero<u16>), (O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O11: GeneticOperator<G, F, Fe, R, C>, O12: GeneticOperator<G, F, Fe, R, C>, O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O12, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O12, NonZero<u16>), (O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O12: GeneticOperator<G, F, Fe, R, C>, O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O15, NonZero<u16>), (O16, NonZero<u16>))>
where O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O16, NonZero<u16>),)>
where O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O2, NonZero<u16>), (O3, NonZero<u16>), (O4, NonZero<u16>), (O5, NonZero<u16>), (O6, NonZero<u16>), (O7, NonZero<u16>), (O8, NonZero<u16>), (O9, NonZero<u16>), (O10, NonZero<u16>), (O11, NonZero<u16>), (O12, NonZero<u16>), (O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O2: GeneticOperator<G, F, Fe, R, C>, O3: GeneticOperator<G, F, Fe, R, C>, O4: GeneticOperator<G, F, Fe, R, C>, O5: GeneticOperator<G, F, Fe, R, C>, O6: GeneticOperator<G, F, Fe, R, C>, O7: GeneticOperator<G, F, Fe, R, C>, O8: GeneticOperator<G, F, Fe, R, C>, O9: GeneticOperator<G, F, Fe, R, C>, O10: GeneticOperator<G, F, Fe, R, C>, O11: GeneticOperator<G, F, Fe, R, C>, O12: GeneticOperator<G, F, Fe, R, C>, O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O3, NonZero<u16>), (O4, NonZero<u16>), (O5, NonZero<u16>), (O6, NonZero<u16>), (O7, NonZero<u16>), (O8, NonZero<u16>), (O9, NonZero<u16>), (O10, NonZero<u16>), (O11, NonZero<u16>), (O12, NonZero<u16>), (O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O3: GeneticOperator<G, F, Fe, R, C>, O4: GeneticOperator<G, F, Fe, R, C>, O5: GeneticOperator<G, F, Fe, R, C>, O6: GeneticOperator<G, F, Fe, R, C>, O7: GeneticOperator<G, F, Fe, R, C>, O8: GeneticOperator<G, F, Fe, R, C>, O9: GeneticOperator<G, F, Fe, R, C>, O10: GeneticOperator<G, F, Fe, R, C>, O11: GeneticOperator<G, F, Fe, R, C>, O12: GeneticOperator<G, F, Fe, R, C>, O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O4, NonZero<u16>), (O5, NonZero<u16>), (O6, NonZero<u16>), (O7, NonZero<u16>), (O8, NonZero<u16>), (O9, NonZero<u16>), (O10, NonZero<u16>), (O11, NonZero<u16>), (O12, NonZero<u16>), (O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O4: GeneticOperator<G, F, Fe, R, C>, O5: GeneticOperator<G, F, Fe, R, C>, O6: GeneticOperator<G, F, Fe, R, C>, O7: GeneticOperator<G, F, Fe, R, C>, O8: GeneticOperator<G, F, Fe, R, C>, O9: GeneticOperator<G, F, Fe, R, C>, O10: GeneticOperator<G, F, Fe, R, C>, O11: GeneticOperator<G, F, Fe, R, C>, O12: GeneticOperator<G, F, Fe, R, C>, O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O5, NonZero<u16>), (O6, NonZero<u16>), (O7, NonZero<u16>), (O8, NonZero<u16>), (O9, NonZero<u16>), (O10, NonZero<u16>), (O11, NonZero<u16>), (O12, NonZero<u16>), (O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O5: GeneticOperator<G, F, Fe, R, C>, O6: GeneticOperator<G, F, Fe, R, C>, O7: GeneticOperator<G, F, Fe, R, C>, O8: GeneticOperator<G, F, Fe, R, C>, O9: GeneticOperator<G, F, Fe, R, C>, O10: GeneticOperator<G, F, Fe, R, C>, O11: GeneticOperator<G, F, Fe, R, C>, O12: GeneticOperator<G, F, Fe, R, C>, O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O6, O7, O8, O9, O10, O11, O12, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O6, NonZero<u16>), (O7, NonZero<u16>), (O8, NonZero<u16>), (O9, NonZero<u16>), (O10, NonZero<u16>), (O11, NonZero<u16>), (O12, NonZero<u16>), (O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O6: GeneticOperator<G, F, Fe, R, C>, O7: GeneticOperator<G, F, Fe, R, C>, O8: GeneticOperator<G, F, Fe, R, C>, O9: GeneticOperator<G, F, Fe, R, C>, O10: GeneticOperator<G, F, Fe, R, C>, O11: GeneticOperator<G, F, Fe, R, C>, O12: GeneticOperator<G, F, Fe, R, C>, O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O7, O8, O9, O10, O11, O12, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O7, NonZero<u16>), (O8, NonZero<u16>), (O9, NonZero<u16>), (O10, NonZero<u16>), (O11, NonZero<u16>), (O12, NonZero<u16>), (O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O7: GeneticOperator<G, F, Fe, R, C>, O8: GeneticOperator<G, F, Fe, R, C>, O9: GeneticOperator<G, F, Fe, R, C>, O10: GeneticOperator<G, F, Fe, R, C>, O11: GeneticOperator<G, F, Fe, R, C>, O12: GeneticOperator<G, F, Fe, R, C>, O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O8, O9, O10, O11, O12, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O8, NonZero<u16>), (O9, NonZero<u16>), (O10, NonZero<u16>), (O11, NonZero<u16>), (O12, NonZero<u16>), (O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O8: GeneticOperator<G, F, Fe, R, C>, O9: GeneticOperator<G, F, Fe, R, C>, O10: GeneticOperator<G, F, Fe, R, C>, O11: GeneticOperator<G, F, Fe, R, C>, O12: GeneticOperator<G, F, Fe, R, C>, O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O9, O10, O11, O12, O13, O14, O15, O16> GeneticOperator<G, F, Fe, R, C> for Weighted<((O9, NonZero<u16>), (O10, NonZero<u16>), (O11, NonZero<u16>), (O12, NonZero<u16>), (O13, NonZero<u16>), (O14, NonZero<u16>), (O15, NonZero<u16>), (O16, NonZero<u16>))>
where O9: GeneticOperator<G, F, Fe, R, C>, O10: GeneticOperator<G, F, Fe, R, C>, O11: GeneticOperator<G, F, Fe, R, C>, O12: GeneticOperator<G, F, Fe, R, C>, O13: GeneticOperator<G, F, Fe, R, C>, O14: GeneticOperator<G, F, Fe, R, C>, O15: GeneticOperator<G, F, Fe, R, C>, O16: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O> GeneticOperator<G, F, Fe, R, C> for Weighted<Box<[(O, NonZero<u16>)]>>
where O: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more
Source§

impl<G, F, Fe, R, C, O> GeneticOperator<G, F, Fe, R, C> for Weighted<Vec<(O, NonZero<u16>)>>
where O: GeneticOperator<G, F, Fe, R, C>, R: Rng,

Source§

fn apply( &self, state: &State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to a borrowed state and returns the resulting offspring. Read more
Source§

fn transform( &self, state: State<G, F>, ctx: &mut Context<'_, Fe, R, C>, ) -> Offspring<G, F>

Applies this operator to an owned state, allowing in-place modification. Read more

Auto Trait Implementations§

§

impl<O> Freeze for Weighted<O>
where O: Freeze + ?Sized,

§

impl<O> RefUnwindSafe for Weighted<O>
where O: RefUnwindSafe + ?Sized,

§

impl<O> Send for Weighted<O>
where O: Send + ?Sized,

§

impl<O> Sync for Weighted<O>
where O: Sync + ?Sized,

§

impl<O> Unpin for Weighted<O>
where O: Unpin + ?Sized,

§

impl<O> UnsafeUnpin for Weighted<O>
where O: UnsafeUnpin + ?Sized,

§

impl<O> UnwindSafe for Weighted<O>
where O: UnwindSafe + ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.