[][src]Struct game_features::LootTree

pub struct LootTree<R> { /* fields omitted */ }

A loot tree based on the lower partial function construct. Each loot tree node has a chance associated with it.

Example: { chance: 5, result: "item1" } { chance: 2, result: "item2" }

Internally this becomes [0,infinite[ -> item1 [5,infinite[ -> item2 maximum = 7 exclusive (that means 6)

Chances will effectively be: [0,4] (5) -> item1 [5,6] (2) -> item2

Methods

impl<R> LootTree<R>[src]

pub fn roll(&self) -> Option<R>[src]

Auto Trait Implementations

impl<R> !Send for LootTree<R>

impl<R> !Sync for LootTree<R>

Blanket Implementations

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

impl<T> From for 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> 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> Any for T where
    T: 'static + ?Sized
[src]