Struct livesplit_core::run::Run

source ·
pub struct Run { /* private fields */ }
Expand description

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"));

Implementations§

Creates a new Run object with no segments.

Accesses the name of the game this Run is for.

Sets the name of the game this Run is for.

Accesses the game’s icon.

Sets the game’s icon.

Accesses the name of the category this Run is for.

Sets the name of the category this Run is for.

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

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

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

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

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

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

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

Accesses the Segments of this Run object.

Grants mutable access to the Segments of this Run object.

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

Accesses a certain segment of this Run.

Panics

Panics if the index is out of bounds.

Mutably accesses a certain segment of this Run.

Panics

Panics if the index is out of bounds.

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.

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

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.

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

Accesses the Comparison Generators in use by this Run.

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

Accesses the Auto Splitter Settings that are encoded as XML.

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.

Returns the amount of segments stored in this Run.

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

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

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

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

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

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.

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.

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

Recalculates all the comparison times the Comparison Generators provide.

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.

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.

Returns an extended category name that possibly includes the region, platform and variables, depending on the arguments provided. The returned object implements Display where it lazily formats the extended category name. An extended category name may look like this:

Any% (No Tuner, JPN, Wii Emulator)

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

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.

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

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.

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

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

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.

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.

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

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Calculates the total playtime.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Converts self into T using Into<T>. Read more
Causes self to use its Binary implementation when Debug-formatted.
Causes self to use its Display implementation when Debug-formatted.
Causes self to use its LowerExp implementation when Debug-formatted.
Causes self to use its LowerHex implementation when Debug-formatted.
Causes self to use its Octal implementation when Debug-formatted.
Causes self to use its Pointer implementation when Debug-formatted.
Causes self to use its UpperExp implementation when Debug-formatted.
Causes self to use its UpperHex implementation when Debug-formatted.
Formats each item in a sequence. Read more

Returns the argument unchanged.

Query the “status” flags for the self file descriptor.
Create a new SetFdFlags value for use with set_fd_flags. Read more
Set the “status” flags for the self file descriptor. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function.
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function.
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds.
Calls .tap_borrow() only in debug builds, and is erased in release builds.
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Calls .tap_ref() only in debug builds, and is erased in release builds.
Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Calls .tap_deref() only in debug builds, and is erased in release builds.
Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Attempts to convert self into T using TryInto<T>. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more