[][src]Struct mc_sim::run::Run

pub struct Run {
    pub barters: Vec<Drop>,
    pub fights: Vec<Drop>,
}

Represents a single speed run, in which barters are made and blazes are fought. The results of bartering and fighting are stored as a list of drops that can be interrogated to see exactly how lucky or unlucky the run was.

Fields

barters: Vec<Drop>fights: Vec<Drop>

Implementations

impl Run[src]

pub fn new(barters: Vec<Drop>, fights: Vec<Drop>) -> Self[src]

Create a run from the results of bartering with piglins and fighting blazes.

let barters = vec![
    Drop { item: Item::Gravel, roll: 0, count: 1 },
    Drop { item: Item::Gravel, roll: 0, count: 1 },
    Drop { item: Item::EnderPearl, roll: 0, count: 1 },
    Drop { item: Item::Gravel, roll: 0, count: 1 },
    Drop { item: Item::EnderPearl, roll: 0, count: 3 },
];

let fights = vec![
    Drop { item: Item::BlazeRod, roll: 0, count: 0 },
    Drop { item: Item::BlazeRod, roll: 0, count: 0 },
    Drop { item: Item::BlazeRod, roll: 0, count: 1 },
    Drop { item: Item::BlazeRod, roll: 0, count: 0 },
    Drop { item: Item::BlazeRod, roll: 0, count: 0 },
    Drop { item: Item::BlazeRod, roll: 0, count: 1 },
    Drop { item: Item::BlazeRod, roll: 0, count: 1 },
];

let run = Run::new(barters, fights);
assert_eq!(run.total_barters(), 5);
assert_eq!(run.total_pearls(), 4);
assert_eq!(run.total_fights(), 7);
assert_eq!(run.total_rods(), 3);

pub fn total_barters(&self) -> u32[src]

The total number of barters that were made in the run.

pub fn successful_barters(&self) -> u32[src]

pub fn total_pearls(&self) -> u32[src]

The total number of pearls that were obtained during the run.

pub fn total_fights(&self) -> u32[src]

The total number of blazes that were killed in the run.

pub fn successful_fights(&self) -> u32[src]

pub fn total_rods(&self) -> u32[src]

The total number of blaze rods that were obtained during the run.

Trait Implementations

impl Clone for Run[src]

impl Debug for Run[src]

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

impl Serialize for Run[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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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>,