rustyfit 0.4.1

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 Event(pub u8);

impl Event {
    /// Group 0. Start / stop_all
    pub const TIMER: Event = Event(0);
    /// start / stop
    pub const WORKOUT: Event = Event(3);
    /// Start at beginning of workout. Stop at end of each step.
    pub const WORKOUT_STEP: Event = Event(4);
    /// stop_all group 0
    pub const POWER_DOWN: Event = Event(5);
    /// stop_all group 0
    pub const POWER_UP: Event = Event(6);
    /// start / stop group 0
    pub const OFF_COURSE: Event = Event(7);
    /// Stop at end of each session.
    pub const SESSION: Event = Event(8);
    /// Stop at end of each lap.
    pub const LAP: Event = Event(9);
    /// marker
    pub const COURSE_POINT: Event = Event(10);
    /// marker
    pub const BATTERY: Event = Event(11);
    /// Group 1. Start at beginning of activity if VP enabled, when VP pace is changed during activity or VP enabled mid activity. stop_disable when VP disabled.
    pub const VIRTUAL_PARTNER_PACE: Event = Event(12);
    /// Group 0. Start / stop when in alert condition.
    pub const HR_HIGH_ALERT: Event = Event(13);
    /// Group 0. Start / stop when in alert condition.
    pub const HR_LOW_ALERT: Event = Event(14);
    /// Group 0. Start / stop when in alert condition.
    pub const SPEED_HIGH_ALERT: Event = Event(15);
    /// Group 0. Start / stop when in alert condition.
    pub const SPEED_LOW_ALERT: Event = Event(16);
    /// Group 0. Start / stop when in alert condition.
    pub const CAD_HIGH_ALERT: Event = Event(17);
    /// Group 0. Start / stop when in alert condition.
    pub const CAD_LOW_ALERT: Event = Event(18);
    /// Group 0. Start / stop when in alert condition.
    pub const POWER_HIGH_ALERT: Event = Event(19);
    /// Group 0. Start / stop when in alert condition.
    pub const POWER_LOW_ALERT: Event = Event(20);
    /// marker
    pub const RECOVERY_HR: Event = Event(21);
    /// marker
    pub const BATTERY_LOW: Event = Event(22);
    /// Group 1. Start if enabled mid activity (not required at start of activity). Stop when duration is reached. stop_disable if disabled.
    pub const TIME_DURATION_ALERT: Event = Event(23);
    /// Group 1. Start if enabled mid activity (not required at start of activity). Stop when duration is reached. stop_disable if disabled.
    pub const DISTANCE_DURATION_ALERT: Event = Event(24);
    /// Group 1. Start if enabled mid activity (not required at start of activity). Stop when duration is reached. stop_disable if disabled.
    pub const CALORIE_DURATION_ALERT: Event = Event(25);
    /// Group 1.. Stop at end of activity.
    pub const ACTIVITY: Event = Event(26);
    /// marker
    pub const FITNESS_EQUIPMENT: Event = Event(27);
    /// Stop at end of each length.
    pub const LENGTH: Event = Event(28);
    /// marker
    pub const USER_MARKER: Event = Event(32);
    /// marker
    pub const SPORT_POINT: Event = Event(33);
    /// start/stop/marker
    pub const CALIBRATION: Event = Event(36);
    /// marker
    pub const FRONT_GEAR_CHANGE: Event = Event(42);
    /// marker
    pub const REAR_GEAR_CHANGE: Event = Event(43);
    /// marker
    pub const RIDER_POSITION_CHANGE: Event = Event(44);
    /// Group 0. Start / stop when in alert condition.
    pub const ELEV_HIGH_ALERT: Event = Event(45);
    /// Group 0. Start / stop when in alert condition.
    pub const ELEV_LOW_ALERT: Event = Event(46);
    /// marker
    pub const COMM_TIMEOUT: Event = Event(47);
    /// marker
    pub const AUTO_ACTIVITY_DETECT: Event = Event(54);
    /// marker
    pub const DIVE_ALERT: Event = Event(56);
    /// marker
    pub const DIVE_GAS_SWITCHED: Event = Event(57);
    /// marker
    pub const TANK_PRESSURE_RESERVE: Event = Event(71);
    /// marker
    pub const TANK_PRESSURE_CRITICAL: Event = Event(72);
    /// marker
    pub const TANK_LOST: Event = Event(73);
    /// start/stop/marker
    pub const RADAR_THREAT_ALERT: Event = Event(75);
    /// marker
    pub const TANK_BATTERY_LOW: Event = Event(76);
    /// marker - tank pod has connected
    pub const TANK_POD_CONNECTED: Event = Event(81);
    /// marker - tank pod has lost connection
    pub const TANK_POD_DISCONNECTED: Event = Event(82);
}

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

impl fmt::Display for Event {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self.0 {
            0 => write!(f, "timer"),
            3 => write!(f, "workout"),
            4 => write!(f, "workout_step"),
            5 => write!(f, "power_down"),
            6 => write!(f, "power_up"),
            7 => write!(f, "off_course"),
            8 => write!(f, "session"),
            9 => write!(f, "lap"),
            10 => write!(f, "course_point"),
            11 => write!(f, "battery"),
            12 => write!(f, "virtual_partner_pace"),
            13 => write!(f, "hr_high_alert"),
            14 => write!(f, "hr_low_alert"),
            15 => write!(f, "speed_high_alert"),
            16 => write!(f, "speed_low_alert"),
            17 => write!(f, "cad_high_alert"),
            18 => write!(f, "cad_low_alert"),
            19 => write!(f, "power_high_alert"),
            20 => write!(f, "power_low_alert"),
            21 => write!(f, "recovery_hr"),
            22 => write!(f, "battery_low"),
            23 => write!(f, "time_duration_alert"),
            24 => write!(f, "distance_duration_alert"),
            25 => write!(f, "calorie_duration_alert"),
            26 => write!(f, "activity"),
            27 => write!(f, "fitness_equipment"),
            28 => write!(f, "length"),
            32 => write!(f, "user_marker"),
            33 => write!(f, "sport_point"),
            36 => write!(f, "calibration"),
            42 => write!(f, "front_gear_change"),
            43 => write!(f, "rear_gear_change"),
            44 => write!(f, "rider_position_change"),
            45 => write!(f, "elev_high_alert"),
            46 => write!(f, "elev_low_alert"),
            47 => write!(f, "comm_timeout"),
            54 => write!(f, "auto_activity_detect"),
            56 => write!(f, "dive_alert"),
            57 => write!(f, "dive_gas_switched"),
            71 => write!(f, "tank_pressure_reserve"),
            72 => write!(f, "tank_pressure_critical"),
            73 => write!(f, "tank_lost"),
            75 => write!(f, "radar_threat_alert"),
            76 => write!(f, "tank_battery_low"),
            81 => write!(f, "tank_pod_connected"),
            82 => write!(f, "tank_pod_disconnected"),
            _ => write!(f, "Event({})", self.0),
        }
    }
}

impl fmt::Debug for Event {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self.0 {
            0 => write!(f, "Event::TIMER(0)"),
            3 => write!(f, "Event::WORKOUT(3)"),
            4 => write!(f, "Event::WORKOUT_STEP(4)"),
            5 => write!(f, "Event::POWER_DOWN(5)"),
            6 => write!(f, "Event::POWER_UP(6)"),
            7 => write!(f, "Event::OFF_COURSE(7)"),
            8 => write!(f, "Event::SESSION(8)"),
            9 => write!(f, "Event::LAP(9)"),
            10 => write!(f, "Event::COURSE_POINT(10)"),
            11 => write!(f, "Event::BATTERY(11)"),
            12 => write!(f, "Event::VIRTUAL_PARTNER_PACE(12)"),
            13 => write!(f, "Event::HR_HIGH_ALERT(13)"),
            14 => write!(f, "Event::HR_LOW_ALERT(14)"),
            15 => write!(f, "Event::SPEED_HIGH_ALERT(15)"),
            16 => write!(f, "Event::SPEED_LOW_ALERT(16)"),
            17 => write!(f, "Event::CAD_HIGH_ALERT(17)"),
            18 => write!(f, "Event::CAD_LOW_ALERT(18)"),
            19 => write!(f, "Event::POWER_HIGH_ALERT(19)"),
            20 => write!(f, "Event::POWER_LOW_ALERT(20)"),
            21 => write!(f, "Event::RECOVERY_HR(21)"),
            22 => write!(f, "Event::BATTERY_LOW(22)"),
            23 => write!(f, "Event::TIME_DURATION_ALERT(23)"),
            24 => write!(f, "Event::DISTANCE_DURATION_ALERT(24)"),
            25 => write!(f, "Event::CALORIE_DURATION_ALERT(25)"),
            26 => write!(f, "Event::ACTIVITY(26)"),
            27 => write!(f, "Event::FITNESS_EQUIPMENT(27)"),
            28 => write!(f, "Event::LENGTH(28)"),
            32 => write!(f, "Event::USER_MARKER(32)"),
            33 => write!(f, "Event::SPORT_POINT(33)"),
            36 => write!(f, "Event::CALIBRATION(36)"),
            42 => write!(f, "Event::FRONT_GEAR_CHANGE(42)"),
            43 => write!(f, "Event::REAR_GEAR_CHANGE(43)"),
            44 => write!(f, "Event::RIDER_POSITION_CHANGE(44)"),
            45 => write!(f, "Event::ELEV_HIGH_ALERT(45)"),
            46 => write!(f, "Event::ELEV_LOW_ALERT(46)"),
            47 => write!(f, "Event::COMM_TIMEOUT(47)"),
            54 => write!(f, "Event::AUTO_ACTIVITY_DETECT(54)"),
            56 => write!(f, "Event::DIVE_ALERT(56)"),
            57 => write!(f, "Event::DIVE_GAS_SWITCHED(57)"),
            71 => write!(f, "Event::TANK_PRESSURE_RESERVE(71)"),
            72 => write!(f, "Event::TANK_PRESSURE_CRITICAL(72)"),
            73 => write!(f, "Event::TANK_LOST(73)"),
            75 => write!(f, "Event::RADAR_THREAT_ALERT(75)"),
            76 => write!(f, "Event::TANK_BATTERY_LOW(76)"),
            81 => write!(f, "Event::TANK_POD_CONNECTED(81)"),
            82 => write!(f, "Event::TANK_POD_DISCONNECTED(82)"),
            _ => write!(f, "Event({})", self.0),
        }
    }
}