[][src]Enum rpick::ConfigCategory

pub enum ConfigCategory {
    Even {
        choices: Vec<String>,
    },
    Gaussian {
        stddev_scaling_factor: f64,
        choices: Vec<String>,
    },
    Inventory {
        choices: Vec<InventoryChoice>,
    },
    LRU {
        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>
Inventory

The Inventory 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 reduced by 1.

Attributes

  • choices - The list of choices to pick from.

Fields of Inventory

choices: Vec<InventoryChoice>
LRU

The LRU variant picks the Least Recently Used item from the list of choices. The least recently used choice is found at the beginning of the list. Once a choice has been accepted, it is moved to the end of the list.

Attributes

  • choices - The list of choices to pick from.

Fields of LRU

choices: 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<'de> Deserialize<'de> for ConfigCategory[src]

impl PartialEq<ConfigCategory> for ConfigCategory[src]

impl Serialize for ConfigCategory[src]

impl StructuralPartialEq for ConfigCategory[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

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

type Error = Infallible

The type returned in the event of a conversion error.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,