[][src]Crate fitparser

FitParser

fitparser is a utility to parse an ANT FIT file based on a given profile into a more useful form for consuming applications. To that end the serde framework is used to allow the data to be serialized into any format supported by serde. This library currently does not support writing FIT files.

Example

Open a file or pass in any other object that implements the Read trait. A vector of data records is returned if deserialization is successful. See the fit_to_json example for a command line utility that parses FIT files and exports them as JSON.

use fitparser;
use std::fs::File;
use std::io::prelude::*;

let mut fp = File::open("tests/fixtures/Activity.fit")?;
for data in fitparser::from_reader(&mut fp)? {
    // print the data in FIT file
    println!("{:#?}", data);
}

Modules

profile

Defines the FIT profile used to convert raw parser output into final values that can be interpreted without using the FIT profile.

Structs

FitDataField

Stores a value and it's defined units which are set by the FIT profile during decoding

FitDataRecord

Defines a set of data derived from a FIT Data message.

ValueWithUnits

Describes a field value along with it's defined units (if any), this struct is useful for serializing data in a key-value store where the key is either the name or definition number since it can be created from a FitDataField with minimal data cloning.

Enums

ErrorKind

The kind of error that can be produced during deserialization. TODO: Handle errors produced by nom cleanly

Value

Contains arbitrary data in the defined format.

Functions

from_bytes

Deserialize a FIT file stored as an array of bytes

from_reader

Deserialize a FIT file stored in a 'readable' source. Currently this just reads all available data into a buffer and then calls from_bytes. This will not be reliable for sources that stream data and may not contain a full FIT file at the time of reading.

Type Definitions

Error

An error that can be produced during deserializing.

Result

The result of a deserialization operation.