Skip to main content

Crate kerb

Crate kerb 

Source
Expand description

Real-time telemetry from sim-racing titles: iRacing, Assetto Corsa, AC Evo, Le Mans Ultimate.

§Quick start

use kerb::{Connection, SimConnection};

let conn = SimConnection::connect().expect("no sim running");
match conn {
    #[cfg(feature = "iracing")]
    Connection::IRacing(c) => {
        c.wait_for_data(16);
        let frame = c.frame().expect("failed to read frame");
        println!("rpm={} gear={}", frame.rpm, frame.gear);
    }
    #[cfg(feature = "ac-evo")]
    Connection::AcEvo(c) => {
        let frame = c.frame().expect("failed to read frame");
        println!("rpm={} gear={}", frame.physics.rpms, frame.physics.gear);
    }
    #[cfg(feature = "lmu")]
    Connection::Lmu(c) => {
        let frame = c.frame().expect("failed to read frame");
        let _ = frame;
    }
    _ => {}
}

§Feature flags

FeatureSimConnection variant
iracingiRacingConnection::IRacing
acAssetto Corsa + AC Evo (auto)Connection::Ac
lmuLe Mans UltimateConnection::Lmu

Enable multiple features if your overlay supports several sims. SimConnection::connect tries each enabled sim in order and returns the first one running.

Modules§

ac_evo
iracing
lmu

Structs§

SimConnection
Entry point for connecting to a running simulator.
SimString
Fixed-length ASCII/CP-1252 string read from simulator shared memory.
SimStringU16
Fixed-length UTF-16 LE string read from simulator shared memory.
VarMeta
Metadata for a single telemetry variable.

Enums§

Connection
A connected simulator. Match on the variant to access its API.
SimError
Errors returned by simulator backends and utility helpers.
SimType
Identifies a specific simulator for use with SimConnection::connect_to.
TelemetryValue
A typed telemetry reading — scalars and fixed-length arrays.

Traits§

HasSnapshot
Implemented by every connection type that can produce a telemetry snapshot.

Functions§

decode_cp1252
Decode a byte slice from Windows-1252 (CP-1252) into a Rust String.
save_session
Write the iRacing session YAML to path.
save_telemetry_snapshot
Capture one telemetry frame and write all variables to path, sorted by name.
save_var_list_snapshot
Write the variable catalogue (name, type, count, unit, description) to path, sorted alphabetically.