This quickstart walks you through the native Rust API. If you want to use livesplit-core from C, Swift, Python, JavaScript, or another language, see the Bindings Overview instead. By the end of this guide you will have a fully functional in-memory timer that you can start, split, pause, reset, and read time values from.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.
Add livesplit-core to your Cargo.toml
Open your project’s Run
Cargo.toml and add livesplit-core as a dependency:Cargo.toml
cargo build once to download and compile the crate and its
dependencies.Create a Timer
Pass the At this point the timer is in the
Run to
Timer::new.
This will fail with CreationError::EmptyRun if the run has no segments,
so always add at least one segment first.TimerPhase::NotRunning state and is
ready to begin an attempt.Control the Timer
All mutating operations return a
Result. In most cases you can safely
.unwrap() them during development; in production you may want to inspect
the error to understand why an operation was rejected (e.g. calling
split() when the timer is not running).| Method | Description |
|---|---|
start() | Begins a new attempt. |
split() | Completes the current segment and advances to the next. |
skip_split() | Skips the current segment without recording a time. |
undo_split() | Goes back to the previous segment. |
pause() | Pauses Real Time accumulation. |
resume() | Resumes a paused timer. |
reset(save) | Ends the attempt; true stores it in history. |
Read the Current Time
To observe the timer without mutating it, take a
Snapshot.
The snapshot captures the exact instant it was created and gives you a
frozen, consistent view of the timer state — safe to read from any thread.current_time() returns a
Time
with two optional fields:real_time— wall-clock elapsed time; always tracked.game_time— elapsed time as reported by the game;Noneuntil your auto splitter or application callsset_game_time.
Explore Further
Timer Concepts
Deep-dive into timer phases, timing methods, and SharedTimer.
Parsing Splits Files
Load .lss and 15+ other split formats from disk or a byte slice.