[][src]Struct livesplit_core::run::Run

pub struct Run { /* fields omitted */ }

A Run stores the split times for a specific game and category of a runner.

Examples

use livesplit_core::{Run, Segment};

let mut run = Run::new();

run.set_game_name("Super Mario Odyssey");
run.set_category_name("Darker Side");

run.push_segment(Segment::new("Cap Kingdom"));
run.push_segment(Segment::new("Cascade Kingdom"));

Methods

impl Run[src]

pub fn new() -> Self[src]

Creates a new Run object with no segments.

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

Accesses the name of the game this Run is for.

pub fn set_game_name<S>(&mut self, name: S) where
    S: AsRef<str>, 
[src]

Sets the name of the game this Run is for.

pub fn game_icon(&self) -> &Image[src]

Accesses the game's icon.

pub fn set_game_icon<D: Into<Image>>(&mut self, image: D)[src]

Sets the game's icon.

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

Accesses the name of the category this Run is for.

pub fn set_category_name<S>(&mut self, name: S) where
    S: AsRef<str>, 
[src]

Sets the name of the category this Run is for.

pub fn set_path(&mut self, path: Option<PathBuf>)[src]

Sets the path of the associated splits file in the file system.

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

Returns the amount of runs that have been attempted with these splits.

pub fn set_attempt_count(&mut self, attempts: u32)[src]

Sets the amount of runs that have been attempted with these splits.

pub fn metadata(&self) -> &RunMetadata[src]

Accesses additional metadata of this Run, like the platform and region of the game.

pub fn metadata_mut(&mut self) -> &mut RunMetadata[src]

Grants mutable access to the additional metadata of this Run, like the platform and region of the game.

pub fn set_offset(&mut self, offset: TimeSpan)[src]

Sets the time an attempt of this Run should start at.

pub fn offset(&self) -> TimeSpan[src]

Accesses the time an attempt of this Run should start at.

pub fn start_next_run(&mut self)[src]

Marks a Run that a new Attempt has started. If you use it with a Timer, this is done automatically.

pub fn segments(&self) -> &[Segment][src]

Accesses the Segments of this Run object.

pub fn segments_mut(&mut self) -> &mut Vec<Segment>[src]

Grants mutable access to the Segments of this Run object.

pub fn push_segment(&mut self, segment: Segment)[src]

Pushes the segment provided to the end of the list of segments of this Run.

pub fn segment(&self, index: usize) -> &Segment[src]

Accesses a certain segment of this Run.

Panics

Panics if the index is out of bounds.

pub fn segment_mut(&mut self, index: usize) -> &mut Segment[src]

Mutably accesses a certain segment of this Run.

Panics

Panics if the index is out of bounds.

pub fn attempt_history(&self) -> &[Attempt][src]

Accesses the history of all the runs that have been attempted. This does not store the actual segment times, just the overall attempt information. Information about the individual segments is stored within each segment.

pub fn custom_comparisons(&self) -> &[String][src]

Accesses the custom comparisons that are stored in this Run. This includes Personal Best but excludes all the other Comparison Generators.

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

Grants mutable access to the custom comparisons that are stored in this Run. This includes Personal Best but excludes all the other Comparison Generators.

Warning

You may not delete the Personal Best comparison.

Important traits for ComparisonsIter<'a>
pub fn comparisons(&self) -> ComparisonsIter[src]

Accesses an iterator that iterates over all the comparisons. This includes both the custom comparisons defined by the user and the Comparison Generators.

pub fn comparison_generators(&self) -> &[Box<dyn ComparisonGenerator>][src]

Accesses the Comparison Generators in use by this Run.

pub fn comparison_generators_mut(
    &mut self
) -> &mut Vec<Box<dyn ComparisonGenerator>>
[src]

Grants mutable access to the Comparison Generators in use by this Run.

pub fn auto_splitter_settings(&self) -> &[u8][src]

Accesses the Auto Splitter Settings that are encoded as XML.

pub fn auto_splitter_settings_mut(&mut self) -> &mut Vec<u8>[src]

Grants mutable access to the XML encoded Auto Splitter Settings.

Warning

You need to ensure that the Auto Splitter Settings are encoded as data that would be valid as an interior of an XML element.

pub fn len(&self) -> usize[src]

Returns the amount of segments stored in this Run.

pub fn is_empty(&self) -> bool[src]

Returns true if there's no segments stored in this Run.

pub fn mark_as_modified(&mut self)[src]

Marks the Run as modified, so that it is known that there are changes that should be saved.

pub fn mark_as_unmodified(&mut self)[src]

Marks the Run as unmodified, so that it is known that all the changes have been saved.

pub fn has_been_modified(&self) -> bool[src]

Returns whether the Run has been modified and should be saved so that the changes don't get lost.

pub fn add_attempt(
    &mut self,
    time: Time,
    started: Option<AtomicDateTime>,
    ended: Option<AtomicDateTime>,
    pause_time: Option<TimeSpan>
)
[src]

Adds a new Attempt to the Run's Attempt History. This is automatically done if the Run is used with a Timer.

pub fn add_attempt_with_index(
    &mut self,
    time: Time,
    index: i32,
    started: Option<AtomicDateTime>,
    ended: Option<AtomicDateTime>,
    pause_time: Option<TimeSpan>
)
[src]

Adds a new Attempt to the Run's Attempt History with a predetermined History Index.

Warning

This index may not overlap with an index that is already in the Attempt History.

pub fn clear_run_id(&mut self)[src]

Clears the speedrun.com Run ID of this Run, as the current Run does not reflect the run on speedrun.com anymore. This may be the case if a new Personal Best is achieved for example.

pub fn add_custom_comparison<S: Into<String>>(
    &mut self,
    comparison: S
) -> ComparisonResult<()>
[src]

Adds a new custom comparison. If a custom comparison with that name already exists, it is not added.

pub fn regenerate_comparisons(&mut self)[src]

Recalculates all the comparison times the Comparison Generators provide.

pub fn extended_file_name(&self, use_extended_category_name: bool) -> String[src]

Returns a file name (without the extension) suitable for this Run that is built the following way:

Game Name - Category Name

If either is empty, the dash is omitted. Special characters that cause problems in file names are also omitted. If an extended category name is used, the variables of the category are appended in a parenthesis.

pub fn extended_name(&self, use_extended_category_name: bool) -> Cow<str>[src]

Returns a name suitable for this Run that is built the following way:

Game Name - Category Name

If either is empty, the dash is omitted. If an extended category name is used, the variables of the category are appended in a parenthesis.

pub fn extended_category_name(
    &self,
    show_region: bool,
    show_platform: bool,
    show_variables: bool
) -> Cow<str>
[src]

Returns an extended category name that possibly includes the region, platform and variables, depending on the arguments provided. An extended category name may look like this:

Any% (No Tuner, JPN, Wii Emulator)

pub fn max_attempt_history_index(&self) -> Option<i32>[src]

Returns the maximum index currently in use by the Attempt History. This mostly serves as a helper function for the Timer.

pub fn fix_splits(&mut self)[src]

Applies some fixing algorithms on the Run. This includes fixing the comparison times and history, removing duplicates in the segment histories and removing empty times.

pub fn clear_history(&mut self)[src]

Clears out the Attempt History and the Segment Histories of all the segments.

pub fn clear_times(&mut self)[src]

Clears out the Attempt History, the Segment Histories, all the times, sets the Attempt Count to 0 and clears the speedrun.com run id association. All Custom Comparisons other than Personal Best are deleted as well.

pub fn min_segment_history_index(&self) -> Option<i32>[src]

Returns the minimum index in use by all the Segment Histories. None is returned if the Run has no segments.

pub fn import_pb_into_segment_history(&mut self)[src]

Fixes the Segment History by calculating the segment times from the Personal Best times and adding those to the Segment History.

pub fn import_best_segment(&mut self, segment_index: usize)[src]

Fixes a segment's Segment History by adding its Best Segment Time to its Segment History.

Panics

This panics if the segment index provided is out of bounds.

pub fn update_segment_history(&mut self, current_split_index: usize)[src]

Updates the Segment History by adding the split times of the most recent attempt up to the provided current split index to the Segment History.

Panics

This panics if there is no attempt in the Attempt History.

pub fn validate_comparison_name(&self, new: &str) -> ComparisonResult<()>[src]

Checks a given name against the current comparisons in the Run to ensure that it is valid for use.

Trait Implementations

impl TotalPlaytime for Run[src]

impl Default for Run[src]

impl Clone for Run[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<Run> for Run[src]

impl Debug for Run[src]

Auto Trait Implementations

impl Send for Run

impl Sync for Run

Blanket Implementations

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

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

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

fn adapt_into(self) -> D[src]

Convert the source color to the destination color using the bradford method by default Read more

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.