Struct mist_core::Run[][src]

pub struct Run { /* fields omitted */ }
Expand description

Holds information about a speedrun and a user’s times.

Implementations

impl Run[src]

pub fn empty() -> Self[src]

Create a run with all empty fields.

pub fn new<S>(
    game_title: S,
    category: S,
    offset: Option<u128>,
    pb: u128,
    splits: &Vec<String>,
    pb_times: &Vec<u128>,
    gold_times: &Vec<u128>,
    sum_times: &Vec<(u128, u128)>
) -> Self where
    S: ToString
[src]

pub fn game_title(&self) -> &str[src]

Get the game title.

pub fn category(&self) -> &str[src]

Get the speedrun category.

pub fn offset(&self) -> Option<u128>[src]

Get start offset of run in milliseconds. None means no offset.

pub fn pb(&self) -> u128[src]

Get the pb of the run in ms.

pub fn splits(&self) -> &Vec<String>[src]

Returns the split names in the run.

pub fn pb_times(&self) -> &Vec<u128>[src]

Returns the times that were set on each split on the last personal best.

pub fn gold_times(&self) -> &Vec<u128>[src]

Returns the best time that the runner has achieved on each split.

pub fn sum_times(&self) -> &Vec<(u128, u128)>[src]

Returns tuples of attempt count and total number of milliseconds spent for each split. First element is attempt count and second is the total time.

Useful for calculating averages.

pub fn set_game_title<S>(&mut self, new: S) where
    S: ToString
[src]

Sets the game title field.

pub fn set_category<S>(&mut self, new: S) where
    S: ToString
[src]

Sets the name of the category.

pub fn set_offset(&mut self, new: Option<u128>)[src]

Sets the start offset of the run.

pub fn set_pb(&mut self, new: u128)[src]

Set the pb of the run.

pub fn set_splits(&mut self, new: &Vec<String>)[src]

Set the names of all splits.

pub fn set_pb_times(&mut self, new: &Vec<u128>)[src]

Set the times for each split that were achieved on the current pb.

pub fn set_gold_times(&mut self, new: &Vec<u128>)[src]

Set the best times on each split..

pub fn set_gold_time(&mut self, new: u128, idx: usize)[src]

pub fn set_sum_times(&mut self, new: &Vec<(u128, u128)>)[src]

Set the attempt count and total time for all splits. First element is number of attempts of that split and second is the total time.

Trait Implementations

impl Debug for Run[src]

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

Formats the value using the given formatter. Read more

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

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for Run[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

impl RefUnwindSafe for Run

impl Send for Run

impl Sync for Run

impl Unpin for Run

impl UnwindSafe for Run

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

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

Performs the conversion.

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.

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

Performs the conversion.

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