[][src]Enum rpick::ConfigCategory

pub enum ConfigCategory {
    Even {
        choices: Vec<String>,
    },
    Gaussian {
        stddev_scaling_factor: f64,
        choices: Vec<String>,
    },
    Lottery {
        choices: Vec<LotteryChoice>,
    },
    Weighted {
        choices: Vec<WeightedChoice>,
    },
}

A category of items that can be chosen from.

Each variant of this Enum maps to one of the supported algorithms.

Variants

Even

The Even variant picks from its choices with even distribution.

Attributes

  • choices - The list of choices to pick from.

Fields of Even

choices: Vec<String>
Gaussian

The Gaussian variant uses a Gaussian distribution to prefer choices near the beginning of the list of choices over those at the end. Once a choice has been accepted, it is moved to the end of the list.

Attributes

  • stddev_scaling_factor - This is used to derive the standard deviation; the standard deviation is the length of the list of choices, divided by this scaling factor.
  • choices - The list of choices to pick from.

Fields of Gaussian

stddev_scaling_factor: f64choices: Vec<String>
Lottery

The Lottery variant uses a weighted distribution to pick items, with each items chances being tied to how many tickets it has. When a choice is accepted, that choice's ticket count is set to 0, and every choice not chosen receives its weight in additional tickets.

Attributes

  • choices - The list of choices to pick from.

Fields of Lottery

choices: Vec<LotteryChoice>
Weighted

The Weighted variant is a simple weighted distribution.

Attributes

  • choices - The list of choices to pick from.

Fields of Weighted

choices: Vec<WeightedChoice>

Trait Implementations

impl PartialEq<ConfigCategory> for ConfigCategory[src]

impl Serialize for ConfigCategory[src]

impl<'de> Deserialize<'de> for ConfigCategory[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

impl<T, U> TryInto 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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]