[][src]Struct livesplit_core::run::editor::Editor

pub struct Editor { /* fields omitted */ }

The Run Editor allows modifying Runs while ensuring that all the different invariants of the Run objects are upheld no matter what kind of operations are being applied to the Run. It provides the current state of the editor as state objects that can be visualized by any kind of User Interface.

Methods

impl Editor[src]

pub fn state(&mut self) -> State[src]

Calculates the Run Editor's state in order to visualize it.

impl Editor[src]

pub fn new(run: Run) -> Result<Self, OpenError>[src]

Creates a new Run Editor that modifies the Run provided. Creation of the Run Editor fails when a Run with no segments is provided.

pub fn close(self) -> Run[src]

Closes the Run Editor and gives back access to the modified Run object. In case you want to implement a Cancel Button, just drop the Run object you get here.

pub fn run(&self) -> &Run[src]

Accesses the Run being edited by the Run Editor.

pub fn selected_timing_method(&self) -> TimingMethod[src]

Accesses the timing method that is currently selected for being modified.

pub fn select_timing_method(&mut self, method: TimingMethod)[src]

Selects a different timing method for being modified.

pub fn active_segment(&mut self) -> SegmentRow[src]

Grants mutable access to the actively selected segment row. You can select multiple segment rows at the same time, but only the one that is most recently selected is the active segment.

pub fn unselect(&mut self, index: usize)[src]

Unselects the segment with the given index. If it's not selected or the index is out of bounds, nothing happens. The segment is not unselected, when it is the only segment that is selected. If the active segment is unselected, the most recently selected segment remaining becomes the active segment.

pub fn select_additionally(&mut self, index: usize)[src]

In addition to the segments that are already selected, the segment with the given index is being selected. The segment chosen also becomes the active segment.

Panics

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

pub fn select_only(&mut self, index: usize)[src]

Selects the segment with the given index. All other segments are unselected. The segment chosen also becomes the active segment.

Panics

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

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

Accesses the name of the game.

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

Sets the name of the game.

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

Accesses the name of the category.

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

Sets the name of the category.

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

Accesses the timer offset. The timer offset specifies the time, the timer starts at when starting a new attempt.

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

Sets the timer offset. The timer offset specifies the time, the timer starts at when starting a new attempt.

pub fn parse_and_set_offset<S>(&mut self, offset: S) -> Result<(), ParseError> where
    S: AsRef<str>, 
[src]

Parses and sets the timer offset from the string provided. The timer offset specifies the time, the timer starts at when starting a new attempt.

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

Accesses the attempt count.

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

Sets the attempt count. Changing this has no affect on the attempt history or the segment history. This number is mostly just a visual number for the runner.

pub fn parse_and_set_attempt_count<S>(
    &mut self,
    attempts: S
) -> Result<(), ParseIntError> where
    S: AsRef<str>, 
[src]

Parses and sets the attempt count from the string provided. Changing this has no affect on the attempt history or the segment history. This number is mostly just a visual number for the runner.

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 remove_game_icon(&mut self)[src]

Removes the game's icon.

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

Accesses all the custom comparisons that exist on the Run.

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

Sets the speedrun.com Run ID of the run. You need to ensure that the record on speedrun.com matches up with the Personal Best of this run. This may be empty if there's no association.

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

Sets the name of the region this game is from. This may be empty if it's not specified.

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

Sets the name of the platform this game is run on. This may be empty if it's not specified.

pub fn set_emulator_usage(&mut self, uses_emulator: bool)[src]

Specifies whether this speedrun is done on an emulator. Keep in mind that false may also mean that this information is simply not known.

pub fn set_variable<N, V>(&mut self, name: N, value: V) where
    N: Into<String>,
    V: Into<String>, 
[src]

Sets the variable with the name specified to the value specified. A variable is an arbitrary key value pair storing additional information about the category. An example of this may be whether Amiibos are used in this category. If the variable doesn't exist yet, it is being inserted.

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

Removes the variable with the name specified.

pub fn clear_metadata(&mut self)[src]

Resets all the Metadata Information.

pub fn insert_segment_above(&mut self)[src]

Inserts a new empty segment above the active segment and adjusts the Run's history information accordingly. The newly created segment is then the only selected segment and also the active segment.

pub fn insert_segment_below(&mut self)[src]

Inserts a new empty segment below the active segment and adjusts the Run's history information accordingly. The newly created segment is then the only selected segment and also the active segment.

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

Checks if the currently selected segments can be removed. If all segments are selected, they can't be removed.

pub fn remove_segments(&mut self)[src]

Removes all the selected segments, unless all of them are selected. The run's information is automatically adjusted properly. The next not-to-be-removed segment after the active segment becomes the new active segment. If there's none, then the next not-to-be-removed segment before the active segment, becomes the new active segment.

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

Checks if the currently selected segments can be moved up. If any one of the selected segments is the first segment, then they can't be moved.

pub fn move_segments_up(&mut self)[src]

Moves all the selected segments up, unless the first segment is selected. The run's information is automatically adjusted properly. The active segment stays the active segment.

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

Checks if the currently selected segments can be moved down. If any one of the selected segments is the last segment, then they can't be moved.

pub fn move_segments_down(&mut self)[src]

Moves all the selected segments down, unless the last segment is selected. The run's information is automatically adjusted properly. The active segment stays the active segment.

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

Adds a new custom comparison. It can't be added if it starts with [Race] or already exists.

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

Imports the Personal Best from the provided run as a comparison. The comparison can't be added if its name starts with [Race] or it already exists.

pub fn remove_comparison(&mut self, comparison: &str)[src]

Removes the chosen custom comparison. You can't remove a Comparison Generator's Comparison or the Personal Best.

pub fn rename_comparison(
    &mut self,
    old: &str,
    new: &str
) -> Result<(), RenameError>
[src]

Renames a comparison. The comparison can't be renamed if the new name of the comparison starts with [Race] or it already exists.

pub fn move_comparison(
    &mut self,
    src_index: usize,
    dst_index: usize
) -> Result<(), ()>
[src]

Reorders the custom comparisons by moving the comparison with the src_index specified to the dst_index specified. Returns Err(()) if one of the indices is invalid. The indices are based on the comparison_names field of the Run Editor's State.

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 clean_sum_of_best(&mut self) -> SumOfBestCleaner[src]

Creates a Sum of Best Cleaner which allows you to interactively remove potential issues in the segment history that lead to an inaccurate Sum of Best. If you skip a split, whenever you will do the next split, the combined segment time might be faster than the sum of the individual best segments. The Sum of Best Cleaner will point out all of these and allows you to delete them individually if any of them seem wrong.

Auto Trait Implementations

impl Send for Editor

impl Sync for Editor

Blanket Implementations

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

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

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.