Documentation Index
Fetch the complete documentation index at: https://mintlify.com/LiveSplit/livesplit-core/llms.txt
Use this file to discover all available pages before exploring further.
What Is a Run?
A Run is the top-level data container for one game-and-category combination. It holds everything needed to describe a speedrun: the game name, category name, the list of splits, every past attempt, the active comparison generators, and auxiliary metadata. Almost every other API in livesplit-core ultimately reads from or writes to a Run.
Key Fields
| Field | Type | Description |
|---|---|---|
game_name | String | The name of the game being run. |
category_name | String | The name of the category (e.g. “Any%”, “100%”). |
attempt_count | u32 | Total number of attempts started with these splits. |
attempt_history | Vec<Attempt> | Metadata for every past attempt (start time, end time, pause time, final time). Does not store per-segment times — those live inside each Segment. |
offset | TimeSpan | A start delay (negative value) or countdown. When the timer starts, it counts up from this offset. |
game_icon | Image | An optional icon for the game. |
Accessing Segments
What Is a Segment?
A Segment represents one split point in a speedrun — a named checkpoint where the runner records a time. Each segment carries:
name— a human-readable label (e.g."Greenpath").split_time— the cumulative time at which the runner hit this split during the current attempt. This is aTimestruct containing an optional real-time and an optional game-time field.- Personal Best split time — the best cumulative time ever recorded at this split. Retrieved with
segment.personal_best_split_time(). best_segment_time— the fastest segment (lap) time ever recorded between the previous split and this one. Retrieved withsegment.best_segment_time().segment_history— aSegmentHistorymap of past segment times, keyed by attempt index. Used by comparison generators to compute averages, medians, etc.- comparison times — a map from comparison name →
Time. Both built-in generated comparisons and user-defined custom comparisons store their split times here, accessible viasegment.comparison(name). icon— an optionalImageicon for the segment.variables— aHashMap<String, String>of per-attempt segment variables, populated at split time from the run’s custom variables.
RunMetadata
RunMetadata stores optional supplementary information about the run, accessible via run.metadata() (or run.metadata_mut() for mutation).
| Field | Description |
|---|---|
run_id | The speedrun.com run ID linking this run to a verified record. Call run.clear_run_id() when the Personal Best changes and the association is no longer valid. |
platform_name | The platform the game is played on (e.g. "Nintendo Switch"). |
uses_emulator | Whether the run is on an emulator. Note: false may simply mean this is unknown. |
region_name | The game region (e.g. "JPN", "USA"). |
speedrun_com_variables | Key-value pairs corresponding to speedrun.com category variables (e.g. "Amiibos" → "No"). |
custom_variables | Arbitrary key-value pairs (CustomVariable) that are independent of speedrun.com. May be permanent (saved to the splits file) or temporary (set at runtime by an auto splitter). |
Comparison Generators
ARun stores a list of ComparisonGenerator objects that automatically recompute derived comparison times after every attempt. By default a new Run is created with the full set of default generators:
run.comparison_generators(). You can inspect or replace them via run.comparison_generators_mut(). After any change to segment history (e.g. at the end of an attempt), call:
Timer does this automatically when an attempt is reset, so you usually don’t need to call it manually.
Custom, hand-authored comparisons (like a secondary goal split set) are stored separately in run.custom_comparisons(). The Personal Best comparison is always the first entry and cannot be removed. Custom comparisons may not begin with the prefix [Race] — that prefix is reserved for race integrations.
Saving to LSS
livesplit-core can save aRun to the LiveSplit Splits (.lss) XML format using run::saver::livesplit::save_run: