Provides parsing of iRacing's .ibt
telemetry files. It's based on the excellent javascript library ibt-telemetry.
To use itelem
, add the following to your Cargo.toml
:
toml
[dependencies]
itelem = "0.1"
or run this command in your project root:
$ cargo add itelem@0.1
Pass in a file or anything that implements Read + Seek
and you can access header information as well as weekend_info
and the samples that contain the most interesting information.
```rust
let file = File::open("./sting.ibt").unwrap();
let mut reader = IbtReader::new(Box::new(file));
asserteq!(reader.header.tickrate, 60);
let weekendinfo = &reader.sessioninfo.weekendinfo; asserteq!(weekendinfo.trackname, "spielberg gp");
let rpm = reader.findvar("RPM".tostring()).unwrap();
let samples: Vec
// There are 3371 samples and with a 60 tick tickrate // meaning that the telemetry file contains 56 seconds of data asserteq!(samples.len(), 3371); let firstsample = samples[1001].getbyheader(&rpm).unwrap(); asserteq!(first_sample, SampleValue::Float32(991.8974)); ```