rustyfit 0.5.0

This project hosts the Rust implementation for The Flexible and Interoperable Data Transfer (FIT) Protocol
Documentation
// Code generated by fitgen/main.go. DO NOT EDIT.

// Copyright 2025 The RustyFIT Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#![allow(unused, clippy::match_single_binding)]

use std::fmt;

#[derive(Clone, Copy, PartialEq)]
pub struct File(pub u8);

impl File {
    /// Read only, single file. Must be in root directory.
    pub const DEVICE: File = File(1);
    /// Read/write, single file. Directory=Settings
    pub const SETTINGS: File = File(2);
    /// Read/write, multiple files, file number = sport type. Directory=Sports
    pub const SPORT: File = File(3);
    /// Read/erase, multiple files. Directory=Activities
    pub const ACTIVITY: File = File(4);
    /// Read/write/erase, multiple files. Directory=Workouts
    pub const WORKOUT: File = File(5);
    /// Read/write/erase, multiple files. Directory=Courses
    pub const COURSE: File = File(6);
    /// Read/write, single file. Directory=Schedules
    pub const SCHEDULES: File = File(7);
    /// Read only, single file. Circular buffer. All message definitions at start of file. Directory=Weight
    pub const WEIGHT: File = File(9);
    /// Read only, single file. Directory=Totals
    pub const TOTALS: File = File(10);
    /// Read/write, single file. Directory=Goals
    pub const GOALS: File = File(11);
    /// Read only. Directory=Blood Pressure
    pub const BLOOD_PRESSURE: File = File(14);
    /// Read only. Directory=Monitoring. File number=sub type.
    pub const MONITORING_A: File = File(15);
    /// Read/erase, multiple files. Directory=Activities
    pub const ACTIVITY_SUMMARY: File = File(20);
    pub const MONITORING_DAILY: File = File(28);
    /// Read only. Directory=Monitoring. File number=identifier
    pub const MONITORING_B: File = File(32);
    /// Read/write/erase. Multiple Files. Directory=Segments
    pub const SEGMENT: File = File(34);
    /// Read/write/erase. Single File. Directory=Segments
    pub const SEGMENT_LIST: File = File(35);
    /// Read/write/erase. Single File. Directory=Settings
    pub const EXD_CONFIGURATION: File = File(40);
    /// 0xF7 - 0xFE reserved for manufacturer specific file types
    pub const MFG_RANGE_MIN: File = File(0xF7);
    /// 0xF7 - 0xFE reserved for manufacturer specific file types
    pub const MFG_RANGE_MAX: File = File(0xFE);
}

impl Default for File {
    fn default() -> Self {
        Self(u8::MAX)
    }
}

impl fmt::Display for File {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self.0 {
            1 => write!(f, "device"),
            2 => write!(f, "settings"),
            3 => write!(f, "sport"),
            4 => write!(f, "activity"),
            5 => write!(f, "workout"),
            6 => write!(f, "course"),
            7 => write!(f, "schedules"),
            9 => write!(f, "weight"),
            10 => write!(f, "totals"),
            11 => write!(f, "goals"),
            14 => write!(f, "blood_pressure"),
            15 => write!(f, "monitoring_a"),
            20 => write!(f, "activity_summary"),
            28 => write!(f, "monitoring_daily"),
            32 => write!(f, "monitoring_b"),
            34 => write!(f, "segment"),
            35 => write!(f, "segment_list"),
            40 => write!(f, "exd_configuration"),
            0xF7 => write!(f, "mfg_range_min"),
            0xFE => write!(f, "mfg_range_max"),
            _ => write!(f, "File({})", self.0),
        }
    }
}

impl fmt::Debug for File {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self.0 {
            1 => write!(f, "File::DEVICE(1)"),
            2 => write!(f, "File::SETTINGS(2)"),
            3 => write!(f, "File::SPORT(3)"),
            4 => write!(f, "File::ACTIVITY(4)"),
            5 => write!(f, "File::WORKOUT(5)"),
            6 => write!(f, "File::COURSE(6)"),
            7 => write!(f, "File::SCHEDULES(7)"),
            9 => write!(f, "File::WEIGHT(9)"),
            10 => write!(f, "File::TOTALS(10)"),
            11 => write!(f, "File::GOALS(11)"),
            14 => write!(f, "File::BLOOD_PRESSURE(14)"),
            15 => write!(f, "File::MONITORING_A(15)"),
            20 => write!(f, "File::ACTIVITY_SUMMARY(20)"),
            28 => write!(f, "File::MONITORING_DAILY(28)"),
            32 => write!(f, "File::MONITORING_B(32)"),
            34 => write!(f, "File::SEGMENT(34)"),
            35 => write!(f, "File::SEGMENT_LIST(35)"),
            40 => write!(f, "File::EXD_CONFIGURATION(40)"),
            0xF7 => write!(f, "File::MFG_RANGE_MIN(0xF7)"),
            0xFE => write!(f, "File::MFG_RANGE_MAX(0xFE)"),
            _ => write!(f, "File({})", self.0),
        }
    }
}