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
| Feature | Sim | Connection variant |
|---|---|---|
iracing | iRacing | Connection::IRacing |
ac | Assetto Corsa + AC Evo (auto) | Connection::Ac |
lmu | Le Mans Ultimate | Connection::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§
Structs§
- SimConnection
- Entry point for connecting to a running simulator.
- SimString
- Fixed-length ASCII/CP-1252 string read from simulator shared memory.
- SimString
U16 - 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. - Telemetry
Value - 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.