#fit #garmin #parser #format #file #byte #fit-file

fitparse

Rust library for parsing files in Garmin FIT format

1 unstable release

Uses old Rust 2015

0.1.0 Jul 14, 2020

#12 in #garmin

MIT license

2.5MB
53K SLoC

Fitparse

Fitparse is a Rust library which implements a parser for Garmin's FIT file format.

Example

use fitparse::fitfile::FitFile;

let mut f = match File::open("/path/to/fit_file.fit").unwrap(); 

let mut fit_file = FitFile::new(
    1024 * 1024 * 10, // maximum file size, here 10 Mb
    true              // retain the raw bytes for per-message inspection
);

match ff.parse(&mut f) {
    Err(e) => panic!("failed to parse file: {:?}", e),
    _ => (),
}

println!("Parsed num messages: {}", ff.messages.len());

println!("Message #42:");
println!("{}", ff.messages[42]);

Dependencies

~8–14MB
~178K SLoC