[][src]Crate livesplit_core

livesplit-core is a library that provides a lot of functionality for creating a speedrun timer.


use livesplit_core::{Run, Segment, Timer, TimerPhase};

// Create a run object that we can use with at least one segment.
let mut run = Run::new();
run.set_game_name("Super Mario Odyssey");
run.push_segment(Segment::new("Cap Kingdom"));

// Create the timer from the run.
let mut timer = Timer::new(run).expect("Run with at least one segment provided");

// Start a new attempt.
assert_eq!(timer.current_phase(), TimerPhase::Running);

// Create a split.

// The run should be finished now.
assert_eq!(timer.current_phase(), TimerPhase::Ended);

// Reset the attempt and confirm that we want to store the attempt.

// The attempt is now over.
assert_eq!(timer.current_phase(), TimerPhase::NotRunning);


pub use crate::layout::Editor as LayoutEditor;
pub use crate::layout::Layout;
pub use crate::run::Editor as RunEditor;
pub use crate::run::Run;
pub use indexmap;
pub use livesplit_hotkey as hotkey;
pub use palette;
pub use parking_lot;



The analysis module provides a variety of functions for calculating information about runs.


The comparison module provides all the different automatically generated comparisons, like the Best Segments and the Average Segments. Additionally, functions for dealing with comparisons, like shortening a comparison, are provided.


The component module provides all the different components available. A Component allows querying different kinds of information from a Timer. This information is provided as state objects in a way that can easily be visualized by any kind of User Interface.


The layout module provides everything necessary for working with Layouts. A Layout allows you to combine multiple components together to visualize a variety of information the runner is interested in.


The run module provides everything necessary for working with Runs, like parsing and saving or editing them.


The settings module provides the ability to customize components and various other settings.


The timing module provides everything necessary for working with times and measuring them.



An Atomic Date Time represents a UTC Date Time that tries to be as close to an atomic clock as possible.


An Attempt describes information about an attempt to run a specific category by a specific runner in the past. Every time a new attempt is started and then reset, an Attempt describing general information about it is created.


ISO 8601 combined date and time with time zone.


Represents a Time Span intended to be used as a Game Time.


The general settings of the layout that apply to all components.


The configuration to use for a Hotkey System. It describes with keys to use as hotkeys for the different actions.


With a Hotkey System the runner can use hotkeys on their keyboard to control the Timer. The hotkeys are global, so the application doesn't need to be in focus. The behavior of the hotkeys depends on the platform and is stubbed out on platforms that don't support hotkeys. You can turn off a Hotkey System temporarily. By default the Hotkey System is activated.


Images can be used to store segment and game icons. Each image object comes with an ID that changes whenever the image is modified. IDs are unique across different images. You can query the image's data as a Data URL. There's no specific image format you need to use for the images.


Represents a Time Span intended to be used as a Real Time.


The Run Metadata stores additional information about a run, like the platform and region of the game. All of this information is optional.


A Segment describes a point in a speedrun that is suitable for storing a split time. This stores the name of that segment, an icon, the split times of different comparisons, and a history of segment times.


Stores the segment times achieved for a certain segment. Each segment is tagged with an index. Only segment times with an index larger than 0 are considered times actually achieved by the runner, while the others are artifacts of route changes and similar algorithmic changes.


A time that can store a Real Time and a Game Time. Both of them are optional.


A Time Span represents a certain span of time.


A Time Stamp stores a point in time, that can be used to calculate Time Spans.


A Timer provides all the capabilities necessary for doing speedrun attempts.


The UTC time zone. This is the most efficient time zone when you don't need the local time. It is also used as an offset (which is also a dummy type).



With a Cached Image ID you can track image changes. It starts with an uncached state and then gets updated with the images provided to it. It can be reset at any point in order to force a change to be detected.


A Component provides information about a run in a way that is easy to visualize. This type can store any of the components provided by this crate.


Describes which phase the timer is currently in. This tells you if there's an active speedrun attempt and whether it is paused or it ended.


A Timing Method describes which form of timing is used. This can either be Real Time or Game Time.

Type Definitions


A Shared Timer is a wrapper around the Timer that can be shared across multiple threads with multiple owners.