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, ReadResult, SimConnection};

let conn = SimConnection::connect().expect("no sim running");
match conn {
    #[cfg(feature = "iracing")]
    Connection::IRacing(c) => {
        if let ReadResult::Frame(frame) = c.read_frame(16) {
            println!("rpm={} gear={}", frame.rpm, frame.gear);
        }
    }
    #[cfg(feature = "ac-evo")]
    Connection::AcEvo(c) => {
        if let ReadResult::Frame(frame) = c.read_frame(0) {
            println!("rpm={} gear={}", frame.physics.rpms, frame.physics.gear);
        }
    }
    #[cfg(feature = "lmu")]
    Connection::Lmu(c) => {
        if let ReadResult::Frame(frame) = c.read_frame(0) {
            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.
ReadResult
Result of a single [read_frame] call.
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 using the Windows system ACP (e.g. CP-1251 on Russian Windows, CP-1252 on Western).
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.