From a41d77b2e4c4ed4a34621b19a700d7b02310b194 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 23 Feb 2024 23:29:26 +0100 Subject: [PATCH] messages: Parse enum types With this patch, values for enum fields are automatically parsed into the corresponding enum types when using the message structs. If a value cannot be parsed correctly, it is added to a invalid_fields field so that users can manually parse that data if they want to. --- fitparser/src/lib.rs | 93 +- fitparser/src/profile/field_types.rs | 6153 +++++++ fitparser/src/profile/messages.rs | 19517 +++++++++++++++------- fitparser/src/profile/mod.rs | 45 +- generate-fit-profile/src/field_types.rs | 29 + generate-fit-profile/src/messages.rs | 51 +- generate-fit-profile/src/parse.rs | 98 +- 7 files changed, 20049 insertions(+), 5937 deletions(-) diff --git a/fitparser/src/lib.rs b/fitparser/src/lib.rs index 7902f62..b0bcc86 100644 --- a/fitparser/src/lib.rs +++ b/fitparser/src/lib.rs @@ -136,6 +136,11 @@ impl FitDataField { pub fn into_value(self) -> Value { self.value } + + /// Consume the field and return the value with associated units + pub fn into_value_with_units(self) -> ValueWithUnits { + ValueWithUnits::new(self.value, self.units) + } } impl fmt::Display for FitDataField { @@ -326,7 +331,7 @@ impl convert::TryInto for &Value { /// Describes a field value along with its 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. -#[derive(Clone, Debug, Serialize)] +#[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct ValueWithUnits { value: Value, units: String, @@ -337,6 +342,16 @@ impl ValueWithUnits { pub fn new(value: Value, units: String) -> Self { ValueWithUnits { value, units } } + + /// Return a reference to the stored value + pub fn value(&self) -> &Value { + &self.value + } + + /// Return units associated with the value + pub fn units(&self) -> &str { + &self.units + } } impl convert::From for ValueWithUnits { @@ -361,14 +376,32 @@ mod tests { use super::*; use std::collections::HashSet; + fn validate_records(records: Vec, ignore_unexpected_fields: bool) { + let mut options = MessageParseOptions::default(); + options.ignore_unexpected_fields = ignore_unexpected_fields; + for record in records { + validate_record(record, options); + } + } + + fn validate_record(record: FitDataRecord, options: MessageParseOptions) { + if !MesgNum::is_named_variant(record.kind().as_i64()) { + return; + } + let message = Message::parse_with_options(record, options).unwrap(); + assert!( + message.invalid_fields().is_empty(), + "{:?}", + message.invalid_fields() + ); + } + #[test] fn parse_activity() { let data = include_bytes!("../tests/fixtures/Activity.fit").to_vec(); let fit_data = from_bytes(&data).unwrap(); assert_eq!(fit_data.len(), 22); - for record in fit_data { - assert!(Message::parse(record).is_ok()); - } + validate_records(fit_data, false); } #[test] @@ -376,9 +409,7 @@ mod tests { let data = include_bytes!("../tests/fixtures/DeveloperData.fit").to_vec(); let fit_data = from_bytes(&data).unwrap(); assert_eq!(fit_data.len(), 6); - for record in fit_data { - assert!(Message::parse(record).is_ok()); - } + validate_records(fit_data, false); } #[test] @@ -386,9 +417,7 @@ mod tests { let data = include_bytes!("../tests/fixtures/MonitoringFile.fit").to_vec(); let fit_data = from_bytes(&data).unwrap(); assert_eq!(fit_data.len(), 355); - for record in fit_data { - assert!(Message::parse(record).is_ok()); - } + validate_records(fit_data, false); } #[test] @@ -396,9 +425,7 @@ mod tests { let data = include_bytes!("../tests/fixtures/Settings.fit").to_vec(); let fit_data = from_bytes(&data).unwrap(); assert_eq!(fit_data.len(), 3); - for record in fit_data { - assert!(Message::parse(record).is_ok()); - } + validate_records(fit_data, false); } #[test] @@ -406,9 +433,7 @@ mod tests { let data = include_bytes!("../tests/fixtures/WeightScaleMultiUser.fit").to_vec(); let fit_data = from_bytes(&data).unwrap(); assert_eq!(fit_data.len(), 7); - for record in fit_data { - assert!(Message::parse(record).is_ok()); - } + validate_records(fit_data, false); } #[test] @@ -416,9 +441,7 @@ mod tests { let data = include_bytes!("../tests/fixtures/WeightScaleSingleUser.fit").to_vec(); let fit_data = from_bytes(&data).unwrap(); assert_eq!(fit_data.len(), 6); - for record in fit_data { - assert!(Message::parse(record).is_ok()); - } + validate_records(fit_data, false); } #[test] @@ -426,9 +449,7 @@ mod tests { let data = include_bytes!("../tests/fixtures/WorkoutCustomTargetValues.fit").to_vec(); let fit_data = from_bytes(&data).unwrap(); assert_eq!(fit_data.len(), 6); - for record in fit_data { - assert!(Message::parse(record).is_ok()); - } + validate_records(fit_data, false); } #[test] @@ -436,9 +457,7 @@ mod tests { let data = include_bytes!("../tests/fixtures/WorkoutIndividualSteps.fit").to_vec(); let fit_data = from_bytes(&data).unwrap(); assert_eq!(fit_data.len(), 6); - for record in fit_data { - assert!(Message::parse(record).is_ok()); - } + validate_records(fit_data, false); } #[test] @@ -446,9 +465,7 @@ mod tests { let data = include_bytes!("../tests/fixtures/WorkoutRepeatGreaterThanStep.fit").to_vec(); let fit_data = from_bytes(&data).unwrap(); assert_eq!(fit_data.len(), 7); - for record in fit_data { - assert!(Message::parse(record).is_ok()); - } + validate_records(fit_data, false); } #[test] @@ -456,9 +473,7 @@ mod tests { let data = include_bytes!("../tests/fixtures/WorkoutRepeatSteps.fit").to_vec(); let fit_data = from_bytes(&data).unwrap(); assert_eq!(fit_data.len(), 7); - for record in fit_data { - assert!(Message::parse(record).is_ok()); - } + validate_records(fit_data, false); } #[test] @@ -468,13 +483,7 @@ mod tests { let data = include_bytes!("../tests/fixtures/garmin-fenix-5-bike.fit").to_vec(); let fit_data = from_bytes(&data).unwrap(); assert_eq!(fit_data.len(), 143); - let mut options = MessageParseOptions::default(); - options.ignore_unexpected_fields = true; - for record in fit_data { - if MesgNum::is_named_variant(record.kind().as_i64()) { - assert!(Message::parse_with_options(record, options).is_ok()); - } - } + validate_records(fit_data, true); } #[test] @@ -483,13 +492,7 @@ mod tests { let data = include_bytes!("../tests/fixtures/sample_mulitple_header.fit").to_vec(); let fit_data = from_bytes(&data).unwrap(); assert_eq!(fit_data.len(), 3023); - let mut options = MessageParseOptions::default(); - options.ignore_unexpected_fields = true; - for record in fit_data { - if MesgNum::is_named_variant(record.kind().as_i64()) { - assert!(Message::parse_with_options(record, options).is_ok()); - } - } + validate_records(fit_data, true); } #[test] diff --git a/fitparser/src/profile/field_types.rs b/fitparser/src/profile/field_types.rs index 78cec57..26f32e1 100644 --- a/fitparser/src/profile/field_types.rs +++ b/fitparser/src/profile/field_types.rs @@ -3,10 +3,13 @@ #![allow(missing_docs)] #![allow(dead_code)] #![allow(clippy::unreadable_literal)] +use super::{EnumFromStrError, FromValue}; +use crate::ValueWithUnits; use serde::ser::Serializer; use serde::Serialize; use std::convert; use std::fmt; +use std::str::FromStr; #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum File { /// Read only, single file. Must be in root directory. @@ -172,6 +175,39 @@ impl Serialize for File { serializer.serialize_str(&self.to_string()) } } +impl FromStr for File { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "device" => Ok(Self::Device), + "settings" => Ok(Self::Settings), + "sport" => Ok(Self::Sport), + "activity" => Ok(Self::Activity), + "workout" => Ok(Self::Workout), + "course" => Ok(Self::Course), + "schedules" => Ok(Self::Schedules), + "weight" => Ok(Self::Weight), + "totals" => Ok(Self::Totals), + "goals" => Ok(Self::Goals), + "blood_pressure" => Ok(Self::BloodPressure), + "monitoring_a" => Ok(Self::MonitoringA), + "activity_summary" => Ok(Self::ActivitySummary), + "monitoring_daily" => Ok(Self::MonitoringDaily), + "monitoring_b" => Ok(Self::MonitoringB), + "segment" => Ok(Self::Segment), + "segment_list" => Ok(Self::SegmentList), + "exd_configuration" => Ok(Self::ExdConfiguration), + "mfg_range_min" => Ok(Self::MfgRangeMin), + "mfg_range_max" => Ok(Self::MfgRangeMax), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for File { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum MesgNum { FileId, @@ -829,6 +865,140 @@ impl Serialize for MesgNum { } } } +impl FromStr for MesgNum { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "file_id" => Ok(Self::FileId), + "capabilities" => Ok(Self::Capabilities), + "device_settings" => Ok(Self::DeviceSettings), + "user_profile" => Ok(Self::UserProfile), + "hrm_profile" => Ok(Self::HrmProfile), + "sdm_profile" => Ok(Self::SdmProfile), + "bike_profile" => Ok(Self::BikeProfile), + "zones_target" => Ok(Self::ZonesTarget), + "hr_zone" => Ok(Self::HrZone), + "power_zone" => Ok(Self::PowerZone), + "met_zone" => Ok(Self::MetZone), + "sport" => Ok(Self::Sport), + "goal" => Ok(Self::Goal), + "session" => Ok(Self::Session), + "lap" => Ok(Self::Lap), + "record" => Ok(Self::Record), + "event" => Ok(Self::Event), + "device_info" => Ok(Self::DeviceInfo), + "workout" => Ok(Self::Workout), + "workout_step" => Ok(Self::WorkoutStep), + "schedule" => Ok(Self::Schedule), + "weight_scale" => Ok(Self::WeightScale), + "course" => Ok(Self::Course), + "course_point" => Ok(Self::CoursePoint), + "totals" => Ok(Self::Totals), + "activity" => Ok(Self::Activity), + "software" => Ok(Self::Software), + "file_capabilities" => Ok(Self::FileCapabilities), + "mesg_capabilities" => Ok(Self::MesgCapabilities), + "field_capabilities" => Ok(Self::FieldCapabilities), + "file_creator" => Ok(Self::FileCreator), + "blood_pressure" => Ok(Self::BloodPressure), + "speed_zone" => Ok(Self::SpeedZone), + "monitoring" => Ok(Self::Monitoring), + "training_file" => Ok(Self::TrainingFile), + "hrv" => Ok(Self::Hrv), + "ant_rx" => Ok(Self::AntRx), + "ant_tx" => Ok(Self::AntTx), + "ant_channel_id" => Ok(Self::AntChannelId), + "length" => Ok(Self::Length), + "monitoring_info" => Ok(Self::MonitoringInfo), + "pad" => Ok(Self::Pad), + "slave_device" => Ok(Self::SlaveDevice), + "connectivity" => Ok(Self::Connectivity), + "weather_conditions" => Ok(Self::WeatherConditions), + "weather_alert" => Ok(Self::WeatherAlert), + "cadence_zone" => Ok(Self::CadenceZone), + "hr" => Ok(Self::Hr), + "segment_lap" => Ok(Self::SegmentLap), + "memo_glob" => Ok(Self::MemoGlob), + "segment_id" => Ok(Self::SegmentId), + "segment_leaderboard_entry" => Ok(Self::SegmentLeaderboardEntry), + "segment_point" => Ok(Self::SegmentPoint), + "segment_file" => Ok(Self::SegmentFile), + "workout_session" => Ok(Self::WorkoutSession), + "watchface_settings" => Ok(Self::WatchfaceSettings), + "gps_metadata" => Ok(Self::GpsMetadata), + "camera_event" => Ok(Self::CameraEvent), + "timestamp_correlation" => Ok(Self::TimestampCorrelation), + "gyroscope_data" => Ok(Self::GyroscopeData), + "accelerometer_data" => Ok(Self::AccelerometerData), + "three_d_sensor_calibration" => Ok(Self::ThreeDSensorCalibration), + "video_frame" => Ok(Self::VideoFrame), + "obdii_data" => Ok(Self::ObdiiData), + "nmea_sentence" => Ok(Self::NmeaSentence), + "aviation_attitude" => Ok(Self::AviationAttitude), + "video" => Ok(Self::Video), + "video_title" => Ok(Self::VideoTitle), + "video_description" => Ok(Self::VideoDescription), + "video_clip" => Ok(Self::VideoClip), + "ohr_settings" => Ok(Self::OhrSettings), + "exd_screen_configuration" => Ok(Self::ExdScreenConfiguration), + "exd_data_field_configuration" => Ok(Self::ExdDataFieldConfiguration), + "exd_data_concept_configuration" => Ok(Self::ExdDataConceptConfiguration), + "field_description" => Ok(Self::FieldDescription), + "developer_data_id" => Ok(Self::DeveloperDataId), + "magnetometer_data" => Ok(Self::MagnetometerData), + "barometer_data" => Ok(Self::BarometerData), + "one_d_sensor_calibration" => Ok(Self::OneDSensorCalibration), + "monitoring_hr_data" => Ok(Self::MonitoringHrData), + "time_in_zone" => Ok(Self::TimeInZone), + "set" => Ok(Self::Set), + "stress_level" => Ok(Self::StressLevel), + "max_met_data" => Ok(Self::MaxMetData), + "dive_settings" => Ok(Self::DiveSettings), + "dive_gas" => Ok(Self::DiveGas), + "dive_alarm" => Ok(Self::DiveAlarm), + "exercise_title" => Ok(Self::ExerciseTitle), + "dive_summary" => Ok(Self::DiveSummary), + "spo2_data" => Ok(Self::Spo2Data), + "sleep_level" => Ok(Self::SleepLevel), + "jump" => Ok(Self::Jump), + "aad_accel_features" => Ok(Self::AadAccelFeatures), + "beat_intervals" => Ok(Self::BeatIntervals), + "respiration_rate" => Ok(Self::RespirationRate), + "hsa_accelerometer_data" => Ok(Self::HsaAccelerometerData), + "hsa_step_data" => Ok(Self::HsaStepData), + "hsa_spo2_data" => Ok(Self::HsaSpo2Data), + "hsa_stress_data" => Ok(Self::HsaStressData), + "hsa_respiration_data" => Ok(Self::HsaRespirationData), + "hsa_heart_rate_data" => Ok(Self::HsaHeartRateData), + "split" => Ok(Self::Split), + "split_summary" => Ok(Self::SplitSummary), + "hsa_body_battery_data" => Ok(Self::HsaBodyBatteryData), + "hsa_event" => Ok(Self::HsaEvent), + "climb_pro" => Ok(Self::ClimbPro), + "tank_update" => Ok(Self::TankUpdate), + "tank_summary" => Ok(Self::TankSummary), + "sleep_assessment" => Ok(Self::SleepAssessment), + "hrv_status_summary" => Ok(Self::HrvStatusSummary), + "hrv_value" => Ok(Self::HrvValue), + "raw_bbi" => Ok(Self::RawBbi), + "device_aux_battery_info" => Ok(Self::DeviceAuxBatteryInfo), + "hsa_gyroscope_data" => Ok(Self::HsaGyroscopeData), + "chrono_shot_session" => Ok(Self::ChronoShotSession), + "chrono_shot_data" => Ok(Self::ChronoShotData), + "hsa_configuration_data" => Ok(Self::HsaConfigurationData), + "dive_apnea_alarm" => Ok(Self::DiveApneaAlarm), + "hsa_wrist_temperature_data" => Ok(Self::HsaWristTemperatureData), + "mfg_range_min" => Ok(Self::MfgRangeMin), + "mfg_range_max" => Ok(Self::MfgRangeMax), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for MesgNum { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Checksum { /// Allows clear of checksum for flash memory where can only write 1 to 0 without erasing sector. @@ -890,6 +1060,21 @@ impl Serialize for Checksum { } } } +impl FromStr for Checksum { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "clear" => Ok(Self::Clear), + "ok" => Ok(Self::Ok), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Checksum { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum FileFlags { Read, @@ -954,6 +1139,22 @@ impl Serialize for FileFlags { } } } +impl FromStr for FileFlags { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + "erase" => Ok(Self::Erase), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for FileFlags { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum MesgCount { NumPerFile, @@ -1015,6 +1216,22 @@ impl Serialize for MesgCount { serializer.serialize_str(&self.to_string()) } } +impl FromStr for MesgCount { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "num_per_file" => Ok(Self::NumPerFile), + "max_per_file" => Ok(Self::MaxPerFile), + "max_per_file_type" => Ok(Self::MaxPerFileType), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for MesgCount { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// seconds since UTC 00:00 Dec 31 1989 #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DateTime { @@ -1071,6 +1288,20 @@ impl Serialize for DateTime { } } } +impl FromStr for DateTime { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "min" => Ok(Self::Min), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DateTime { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// seconds since 00:00 Dec 31 1989 in local time zone #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LocalDateTime { @@ -1127,6 +1358,20 @@ impl Serialize for LocalDateTime { } } } +impl FromStr for LocalDateTime { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "min" => Ok(Self::Min), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LocalDateTime { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum MessageIndex { /// index @@ -1194,6 +1439,22 @@ impl Serialize for MessageIndex { } } } +impl FromStr for MessageIndex { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "mask" => Ok(Self::Mask), + "reserved" => Ok(Self::Reserved), + "selected" => Ok(Self::Selected), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for MessageIndex { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DeviceIndex { /// Creator of the file is always device index 0. @@ -1249,6 +1510,20 @@ impl Serialize for DeviceIndex { } } } +impl FromStr for DeviceIndex { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "creator" => Ok(Self::Creator), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DeviceIndex { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Gender { Female, @@ -1305,6 +1580,21 @@ impl Serialize for Gender { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Gender { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "female" => Ok(Self::Female), + "male" => Ok(Self::Male), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Gender { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Language { English, @@ -1546,6 +1836,58 @@ impl Serialize for Language { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Language { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "english" => Ok(Self::English), + "french" => Ok(Self::French), + "italian" => Ok(Self::Italian), + "german" => Ok(Self::German), + "spanish" => Ok(Self::Spanish), + "croatian" => Ok(Self::Croatian), + "czech" => Ok(Self::Czech), + "danish" => Ok(Self::Danish), + "dutch" => Ok(Self::Dutch), + "finnish" => Ok(Self::Finnish), + "greek" => Ok(Self::Greek), + "hungarian" => Ok(Self::Hungarian), + "norwegian" => Ok(Self::Norwegian), + "polish" => Ok(Self::Polish), + "portuguese" => Ok(Self::Portuguese), + "slovakian" => Ok(Self::Slovakian), + "slovenian" => Ok(Self::Slovenian), + "swedish" => Ok(Self::Swedish), + "russian" => Ok(Self::Russian), + "turkish" => Ok(Self::Turkish), + "latvian" => Ok(Self::Latvian), + "ukrainian" => Ok(Self::Ukrainian), + "arabic" => Ok(Self::Arabic), + "farsi" => Ok(Self::Farsi), + "bulgarian" => Ok(Self::Bulgarian), + "romanian" => Ok(Self::Romanian), + "chinese" => Ok(Self::Chinese), + "japanese" => Ok(Self::Japanese), + "korean" => Ok(Self::Korean), + "taiwanese" => Ok(Self::Taiwanese), + "thai" => Ok(Self::Thai), + "hebrew" => Ok(Self::Hebrew), + "brazilian_portuguese" => Ok(Self::BrazilianPortuguese), + "indonesian" => Ok(Self::Indonesian), + "malaysian" => Ok(Self::Malaysian), + "vietnamese" => Ok(Self::Vietnamese), + "burmese" => Ok(Self::Burmese), + "mongolian" => Ok(Self::Mongolian), + "custom" => Ok(Self::Custom), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Language { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// Bit field corresponding to language enum type (1 << language). #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LanguageBits0 { @@ -1636,6 +1978,27 @@ impl Serialize for LanguageBits0 { } } } +impl FromStr for LanguageBits0 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "english" => Ok(Self::English), + "french" => Ok(Self::French), + "italian" => Ok(Self::Italian), + "german" => Ok(Self::German), + "spanish" => Ok(Self::Spanish), + "croatian" => Ok(Self::Croatian), + "czech" => Ok(Self::Czech), + "danish" => Ok(Self::Danish), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LanguageBits0 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LanguageBits1 { Dutch, @@ -1725,6 +2088,27 @@ impl Serialize for LanguageBits1 { } } } +impl FromStr for LanguageBits1 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "dutch" => Ok(Self::Dutch), + "finnish" => Ok(Self::Finnish), + "greek" => Ok(Self::Greek), + "hungarian" => Ok(Self::Hungarian), + "norwegian" => Ok(Self::Norwegian), + "polish" => Ok(Self::Polish), + "portuguese" => Ok(Self::Portuguese), + "slovakian" => Ok(Self::Slovakian), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LanguageBits1 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LanguageBits2 { Slovenian, @@ -1814,6 +2198,27 @@ impl Serialize for LanguageBits2 { } } } +impl FromStr for LanguageBits2 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "slovenian" => Ok(Self::Slovenian), + "swedish" => Ok(Self::Swedish), + "russian" => Ok(Self::Russian), + "turkish" => Ok(Self::Turkish), + "latvian" => Ok(Self::Latvian), + "ukrainian" => Ok(Self::Ukrainian), + "arabic" => Ok(Self::Arabic), + "farsi" => Ok(Self::Farsi), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LanguageBits2 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LanguageBits3 { Bulgarian, @@ -1903,6 +2308,27 @@ impl Serialize for LanguageBits3 { } } } +impl FromStr for LanguageBits3 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "bulgarian" => Ok(Self::Bulgarian), + "romanian" => Ok(Self::Romanian), + "chinese" => Ok(Self::Chinese), + "japanese" => Ok(Self::Japanese), + "korean" => Ok(Self::Korean), + "taiwanese" => Ok(Self::Taiwanese), + "thai" => Ok(Self::Thai), + "hebrew" => Ok(Self::Hebrew), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LanguageBits3 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LanguageBits4 { BrazilianPortuguese, @@ -1982,6 +2408,25 @@ impl Serialize for LanguageBits4 { } } } +impl FromStr for LanguageBits4 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "brazilian_portuguese" => Ok(Self::BrazilianPortuguese), + "indonesian" => Ok(Self::Indonesian), + "malaysian" => Ok(Self::Malaysian), + "vietnamese" => Ok(Self::Vietnamese), + "burmese" => Ok(Self::Burmese), + "mongolian" => Ok(Self::Mongolian), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LanguageBits4 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum TimeZone { Almaty, @@ -2558,6 +3003,125 @@ impl Serialize for TimeZone { serializer.serialize_str(&self.to_string()) } } +impl FromStr for TimeZone { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "almaty" => Ok(Self::Almaty), + "bangkok" => Ok(Self::Bangkok), + "bombay" => Ok(Self::Bombay), + "brasilia" => Ok(Self::Brasilia), + "cairo" => Ok(Self::Cairo), + "cape_verde_is" => Ok(Self::CapeVerdeIs), + "darwin" => Ok(Self::Darwin), + "eniwetok" => Ok(Self::Eniwetok), + "fiji" => Ok(Self::Fiji), + "hong_kong" => Ok(Self::HongKong), + "islamabad" => Ok(Self::Islamabad), + "kabul" => Ok(Self::Kabul), + "magadan" => Ok(Self::Magadan), + "mid_atlantic" => Ok(Self::MidAtlantic), + "moscow" => Ok(Self::Moscow), + "muscat" => Ok(Self::Muscat), + "newfoundland" => Ok(Self::Newfoundland), + "samoa" => Ok(Self::Samoa), + "sydney" => Ok(Self::Sydney), + "tehran" => Ok(Self::Tehran), + "tokyo" => Ok(Self::Tokyo), + "us_alaska" => Ok(Self::UsAlaska), + "us_atlantic" => Ok(Self::UsAtlantic), + "us_central" => Ok(Self::UsCentral), + "us_eastern" => Ok(Self::UsEastern), + "us_hawaii" => Ok(Self::UsHawaii), + "us_mountain" => Ok(Self::UsMountain), + "us_pacific" => Ok(Self::UsPacific), + "other" => Ok(Self::Other), + "auckland" => Ok(Self::Auckland), + "kathmandu" => Ok(Self::Kathmandu), + "europe_western_wet" => Ok(Self::EuropeWesternWet), + "europe_central_cet" => Ok(Self::EuropeCentralCet), + "europe_eastern_eet" => Ok(Self::EuropeEasternEet), + "jakarta" => Ok(Self::Jakarta), + "perth" => Ok(Self::Perth), + "adelaide" => Ok(Self::Adelaide), + "brisbane" => Ok(Self::Brisbane), + "tasmania" => Ok(Self::Tasmania), + "iceland" => Ok(Self::Iceland), + "amsterdam" => Ok(Self::Amsterdam), + "athens" => Ok(Self::Athens), + "barcelona" => Ok(Self::Barcelona), + "berlin" => Ok(Self::Berlin), + "brussels" => Ok(Self::Brussels), + "budapest" => Ok(Self::Budapest), + "copenhagen" => Ok(Self::Copenhagen), + "dublin" => Ok(Self::Dublin), + "helsinki" => Ok(Self::Helsinki), + "lisbon" => Ok(Self::Lisbon), + "london" => Ok(Self::London), + "madrid" => Ok(Self::Madrid), + "munich" => Ok(Self::Munich), + "oslo" => Ok(Self::Oslo), + "paris" => Ok(Self::Paris), + "prague" => Ok(Self::Prague), + "reykjavik" => Ok(Self::Reykjavik), + "rome" => Ok(Self::Rome), + "stockholm" => Ok(Self::Stockholm), + "vienna" => Ok(Self::Vienna), + "warsaw" => Ok(Self::Warsaw), + "zurich" => Ok(Self::Zurich), + "quebec" => Ok(Self::Quebec), + "ontario" => Ok(Self::Ontario), + "manitoba" => Ok(Self::Manitoba), + "saskatchewan" => Ok(Self::Saskatchewan), + "alberta" => Ok(Self::Alberta), + "british_columbia" => Ok(Self::BritishColumbia), + "boise" => Ok(Self::Boise), + "boston" => Ok(Self::Boston), + "chicago" => Ok(Self::Chicago), + "dallas" => Ok(Self::Dallas), + "denver" => Ok(Self::Denver), + "kansas_city" => Ok(Self::KansasCity), + "las_vegas" => Ok(Self::LasVegas), + "los_angeles" => Ok(Self::LosAngeles), + "miami" => Ok(Self::Miami), + "minneapolis" => Ok(Self::Minneapolis), + "new_york" => Ok(Self::NewYork), + "new_orleans" => Ok(Self::NewOrleans), + "phoenix" => Ok(Self::Phoenix), + "santa_fe" => Ok(Self::SantaFe), + "seattle" => Ok(Self::Seattle), + "washington_dc" => Ok(Self::WashingtonDc), + "us_arizona" => Ok(Self::UsArizona), + "chita" => Ok(Self::Chita), + "ekaterinburg" => Ok(Self::Ekaterinburg), + "irkutsk" => Ok(Self::Irkutsk), + "kaliningrad" => Ok(Self::Kaliningrad), + "krasnoyarsk" => Ok(Self::Krasnoyarsk), + "novosibirsk" => Ok(Self::Novosibirsk), + "petropavlovsk_kamchatskiy" => Ok(Self::PetropavlovskKamchatskiy), + "samara" => Ok(Self::Samara), + "vladivostok" => Ok(Self::Vladivostok), + "mexico_central" => Ok(Self::MexicoCentral), + "mexico_mountain" => Ok(Self::MexicoMountain), + "mexico_pacific" => Ok(Self::MexicoPacific), + "cape_town" => Ok(Self::CapeTown), + "winkhoek" => Ok(Self::Winkhoek), + "lagos" => Ok(Self::Lagos), + "riyahd" => Ok(Self::Riyahd), + "venezuela" => Ok(Self::Venezuela), + "australia_lh" => Ok(Self::AustraliaLh), + "santiago" => Ok(Self::Santiago), + "manual" => Ok(Self::Manual), + "automatic" => Ok(Self::Automatic), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for TimeZone { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DisplayMeasure { Metric, @@ -2619,6 +3183,22 @@ impl Serialize for DisplayMeasure { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DisplayMeasure { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "metric" => Ok(Self::Metric), + "statute" => Ok(Self::Statute), + "nautical" => Ok(Self::Nautical), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DisplayMeasure { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DisplayHeart { Bpm, @@ -2680,6 +3260,22 @@ impl Serialize for DisplayHeart { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DisplayHeart { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "bpm" => Ok(Self::Bpm), + "max" => Ok(Self::Max), + "reserve" => Ok(Self::Reserve), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DisplayHeart { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DisplayPower { Watts, @@ -2736,6 +3332,21 @@ impl Serialize for DisplayPower { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DisplayPower { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "watts" => Ok(Self::Watts), + "percent_ftp" => Ok(Self::PercentFtp), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DisplayPower { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DisplayPosition { /// dd.dddddd @@ -3034,6 +3645,61 @@ impl Serialize for DisplayPosition { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DisplayPosition { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "degree" => Ok(Self::Degree), + "degree_minute" => Ok(Self::DegreeMinute), + "degree_minute_second" => Ok(Self::DegreeMinuteSecond), + "austrian_grid" => Ok(Self::AustrianGrid), + "british_grid" => Ok(Self::BritishGrid), + "dutch_grid" => Ok(Self::DutchGrid), + "hungarian_grid" => Ok(Self::HungarianGrid), + "finnish_grid" => Ok(Self::FinnishGrid), + "german_grid" => Ok(Self::GermanGrid), + "icelandic_grid" => Ok(Self::IcelandicGrid), + "indonesian_equatorial" => Ok(Self::IndonesianEquatorial), + "indonesian_irian" => Ok(Self::IndonesianIrian), + "indonesian_southern" => Ok(Self::IndonesianSouthern), + "india_zone_0" => Ok(Self::IndiaZone0), + "india_zone_IA" => Ok(Self::IndiaZoneIA), + "india_zone_IB" => Ok(Self::IndiaZoneIB), + "india_zone_IIA" => Ok(Self::IndiaZoneIIA), + "india_zone_IIB" => Ok(Self::IndiaZoneIIB), + "india_zone_IIIA" => Ok(Self::IndiaZoneIIIA), + "india_zone_IIIB" => Ok(Self::IndiaZoneIIIB), + "india_zone_IVA" => Ok(Self::IndiaZoneIVA), + "india_zone_IVB" => Ok(Self::IndiaZoneIVB), + "irish_transverse" => Ok(Self::IrishTransverse), + "irish_grid" => Ok(Self::IrishGrid), + "loran" => Ok(Self::Loran), + "maidenhead_grid" => Ok(Self::MaidenheadGrid), + "mgrs_grid" => Ok(Self::MgrsGrid), + "new_zealand_grid" => Ok(Self::NewZealandGrid), + "new_zealand_transverse" => Ok(Self::NewZealandTransverse), + "qatar_grid" => Ok(Self::QatarGrid), + "modified_swedish_grid" => Ok(Self::ModifiedSwedishGrid), + "swedish_grid" => Ok(Self::SwedishGrid), + "south_african_grid" => Ok(Self::SouthAfricanGrid), + "swiss_grid" => Ok(Self::SwissGrid), + "taiwan_grid" => Ok(Self::TaiwanGrid), + "united_states_grid" => Ok(Self::UnitedStatesGrid), + "utm_ups_grid" => Ok(Self::UtmUpsGrid), + "west_malayan" => Ok(Self::WestMalayan), + "borneo_rso" => Ok(Self::BorneoRso), + "estonian_grid" => Ok(Self::EstonianGrid), + "latvian_grid" => Ok(Self::LatvianGrid), + "swedish_ref_99_grid" => Ok(Self::SwedishRef99Grid), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DisplayPosition { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Switch { Off, @@ -3095,6 +3761,22 @@ impl Serialize for Switch { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Switch { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "off" => Ok(Self::Off), + "on" => Ok(Self::On), + "auto" => Ok(Self::Auto), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Switch { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Sport { Generic, @@ -3488,6 +4170,88 @@ impl Serialize for Sport { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Sport { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "generic" => Ok(Self::Generic), + "running" => Ok(Self::Running), + "cycling" => Ok(Self::Cycling), + "transition" => Ok(Self::Transition), + "fitness_equipment" => Ok(Self::FitnessEquipment), + "swimming" => Ok(Self::Swimming), + "basketball" => Ok(Self::Basketball), + "soccer" => Ok(Self::Soccer), + "tennis" => Ok(Self::Tennis), + "american_football" => Ok(Self::AmericanFootball), + "training" => Ok(Self::Training), + "walking" => Ok(Self::Walking), + "cross_country_skiing" => Ok(Self::CrossCountrySkiing), + "alpine_skiing" => Ok(Self::AlpineSkiing), + "snowboarding" => Ok(Self::Snowboarding), + "rowing" => Ok(Self::Rowing), + "mountaineering" => Ok(Self::Mountaineering), + "hiking" => Ok(Self::Hiking), + "multisport" => Ok(Self::Multisport), + "paddling" => Ok(Self::Paddling), + "flying" => Ok(Self::Flying), + "e_biking" => Ok(Self::EBiking), + "motorcycling" => Ok(Self::Motorcycling), + "boating" => Ok(Self::Boating), + "driving" => Ok(Self::Driving), + "golf" => Ok(Self::Golf), + "hang_gliding" => Ok(Self::HangGliding), + "horseback_riding" => Ok(Self::HorsebackRiding), + "hunting" => Ok(Self::Hunting), + "fishing" => Ok(Self::Fishing), + "inline_skating" => Ok(Self::InlineSkating), + "rock_climbing" => Ok(Self::RockClimbing), + "sailing" => Ok(Self::Sailing), + "ice_skating" => Ok(Self::IceSkating), + "sky_diving" => Ok(Self::SkyDiving), + "snowshoeing" => Ok(Self::Snowshoeing), + "snowmobiling" => Ok(Self::Snowmobiling), + "stand_up_paddleboarding" => Ok(Self::StandUpPaddleboarding), + "surfing" => Ok(Self::Surfing), + "wakeboarding" => Ok(Self::Wakeboarding), + "water_skiing" => Ok(Self::WaterSkiing), + "kayaking" => Ok(Self::Kayaking), + "rafting" => Ok(Self::Rafting), + "windsurfing" => Ok(Self::Windsurfing), + "kitesurfing" => Ok(Self::Kitesurfing), + "tactical" => Ok(Self::Tactical), + "jumpmaster" => Ok(Self::Jumpmaster), + "boxing" => Ok(Self::Boxing), + "floor_climbing" => Ok(Self::FloorClimbing), + "baseball" => Ok(Self::Baseball), + "diving" => Ok(Self::Diving), + "hiit" => Ok(Self::Hiit), + "racket" => Ok(Self::Racket), + "wheelchair_push_walk" => Ok(Self::WheelchairPushWalk), + "wheelchair_push_run" => Ok(Self::WheelchairPushRun), + "meditation" => Ok(Self::Meditation), + "disc_golf" => Ok(Self::DiscGolf), + "cricket" => Ok(Self::Cricket), + "rugby" => Ok(Self::Rugby), + "hockey" => Ok(Self::Hockey), + "lacrosse" => Ok(Self::Lacrosse), + "volleyball" => Ok(Self::Volleyball), + "water_tubing" => Ok(Self::WaterTubing), + "wakesurfing" => Ok(Self::Wakesurfing), + "mixed_martial_arts" => Ok(Self::MixedMartialArts), + "snorkeling" => Ok(Self::Snorkeling), + "dance" => Ok(Self::Dance), + "jump_rope" => Ok(Self::JumpRope), + "all" => Ok(Self::All), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Sport { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// Bit field corresponding to sport enum type (1 << sport). #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SportBits0 { @@ -3579,6 +4343,27 @@ impl Serialize for SportBits0 { } } } +impl FromStr for SportBits0 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "generic" => Ok(Self::Generic), + "running" => Ok(Self::Running), + "cycling" => Ok(Self::Cycling), + "transition" => Ok(Self::Transition), + "fitness_equipment" => Ok(Self::FitnessEquipment), + "swimming" => Ok(Self::Swimming), + "basketball" => Ok(Self::Basketball), + "soccer" => Ok(Self::Soccer), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SportBits0 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// Bit field corresponding to sport enum type (1 << (sport-8)). #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SportBits1 { @@ -3669,6 +4454,27 @@ impl Serialize for SportBits1 { } } } +impl FromStr for SportBits1 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "tennis" => Ok(Self::Tennis), + "american_football" => Ok(Self::AmericanFootball), + "training" => Ok(Self::Training), + "walking" => Ok(Self::Walking), + "cross_country_skiing" => Ok(Self::CrossCountrySkiing), + "alpine_skiing" => Ok(Self::AlpineSkiing), + "snowboarding" => Ok(Self::Snowboarding), + "rowing" => Ok(Self::Rowing), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SportBits1 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// Bit field corresponding to sport enum type (1 << (sport-16)). #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SportBits2 { @@ -3759,6 +4565,27 @@ impl Serialize for SportBits2 { } } } +impl FromStr for SportBits2 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "mountaineering" => Ok(Self::Mountaineering), + "hiking" => Ok(Self::Hiking), + "multisport" => Ok(Self::Multisport), + "paddling" => Ok(Self::Paddling), + "flying" => Ok(Self::Flying), + "e_biking" => Ok(Self::EBiking), + "motorcycling" => Ok(Self::Motorcycling), + "boating" => Ok(Self::Boating), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SportBits2 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// Bit field corresponding to sport enum type (1 << (sport-24)). #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SportBits3 { @@ -3849,6 +4676,27 @@ impl Serialize for SportBits3 { } } } +impl FromStr for SportBits3 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "driving" => Ok(Self::Driving), + "golf" => Ok(Self::Golf), + "hang_gliding" => Ok(Self::HangGliding), + "horseback_riding" => Ok(Self::HorsebackRiding), + "hunting" => Ok(Self::Hunting), + "fishing" => Ok(Self::Fishing), + "inline_skating" => Ok(Self::InlineSkating), + "rock_climbing" => Ok(Self::RockClimbing), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SportBits3 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// Bit field corresponding to sport enum type (1 << (sport-32)). #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SportBits4 { @@ -3939,6 +4787,27 @@ impl Serialize for SportBits4 { } } } +impl FromStr for SportBits4 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "sailing" => Ok(Self::Sailing), + "ice_skating" => Ok(Self::IceSkating), + "sky_diving" => Ok(Self::SkyDiving), + "snowshoeing" => Ok(Self::Snowshoeing), + "snowmobiling" => Ok(Self::Snowmobiling), + "stand_up_paddleboarding" => Ok(Self::StandUpPaddleboarding), + "surfing" => Ok(Self::Surfing), + "wakeboarding" => Ok(Self::Wakeboarding), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SportBits4 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// Bit field corresponding to sport enum type (1 << (sport-40)). #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SportBits5 { @@ -4029,6 +4898,27 @@ impl Serialize for SportBits5 { } } } +impl FromStr for SportBits5 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "water_skiing" => Ok(Self::WaterSkiing), + "kayaking" => Ok(Self::Kayaking), + "rafting" => Ok(Self::Rafting), + "windsurfing" => Ok(Self::Windsurfing), + "kitesurfing" => Ok(Self::Kitesurfing), + "tactical" => Ok(Self::Tactical), + "jumpmaster" => Ok(Self::Jumpmaster), + "boxing" => Ok(Self::Boxing), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SportBits5 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// Bit field corresponding to sport enum type (1 << (sport-48)). #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SportBits6 { @@ -4084,6 +4974,20 @@ impl Serialize for SportBits6 { } } } +impl FromStr for SportBits6 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "floor_climbing" => Ok(Self::FloorClimbing), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SportBits6 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SubSport { Generic, @@ -4649,6 +5553,108 @@ impl Serialize for SubSport { serializer.serialize_str(&self.to_string()) } } +impl FromStr for SubSport { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "generic" => Ok(Self::Generic), + "treadmill" => Ok(Self::Treadmill), + "street" => Ok(Self::Street), + "trail" => Ok(Self::Trail), + "track" => Ok(Self::Track), + "spin" => Ok(Self::Spin), + "indoor_cycling" => Ok(Self::IndoorCycling), + "road" => Ok(Self::Road), + "mountain" => Ok(Self::Mountain), + "downhill" => Ok(Self::Downhill), + "recumbent" => Ok(Self::Recumbent), + "cyclocross" => Ok(Self::Cyclocross), + "hand_cycling" => Ok(Self::HandCycling), + "track_cycling" => Ok(Self::TrackCycling), + "indoor_rowing" => Ok(Self::IndoorRowing), + "elliptical" => Ok(Self::Elliptical), + "stair_climbing" => Ok(Self::StairClimbing), + "lap_swimming" => Ok(Self::LapSwimming), + "open_water" => Ok(Self::OpenWater), + "flexibility_training" => Ok(Self::FlexibilityTraining), + "strength_training" => Ok(Self::StrengthTraining), + "warm_up" => Ok(Self::WarmUp), + "match" => Ok(Self::Match), + "exercise" => Ok(Self::Exercise), + "challenge" => Ok(Self::Challenge), + "indoor_skiing" => Ok(Self::IndoorSkiing), + "cardio_training" => Ok(Self::CardioTraining), + "indoor_walking" => Ok(Self::IndoorWalking), + "e_bike_fitness" => Ok(Self::EBikeFitness), + "bmx" => Ok(Self::Bmx), + "casual_walking" => Ok(Self::CasualWalking), + "speed_walking" => Ok(Self::SpeedWalking), + "bike_to_run_transition" => Ok(Self::BikeToRunTransition), + "run_to_bike_transition" => Ok(Self::RunToBikeTransition), + "swim_to_bike_transition" => Ok(Self::SwimToBikeTransition), + "atv" => Ok(Self::Atv), + "motocross" => Ok(Self::Motocross), + "backcountry" => Ok(Self::Backcountry), + "resort" => Ok(Self::Resort), + "rc_drone" => Ok(Self::RcDrone), + "wingsuit" => Ok(Self::Wingsuit), + "whitewater" => Ok(Self::Whitewater), + "skate_skiing" => Ok(Self::SkateSkiing), + "yoga" => Ok(Self::Yoga), + "pilates" => Ok(Self::Pilates), + "indoor_running" => Ok(Self::IndoorRunning), + "gravel_cycling" => Ok(Self::GravelCycling), + "e_bike_mountain" => Ok(Self::EBikeMountain), + "commuting" => Ok(Self::Commuting), + "mixed_surface" => Ok(Self::MixedSurface), + "navigate" => Ok(Self::Navigate), + "track_me" => Ok(Self::TrackMe), + "map" => Ok(Self::Map), + "single_gas_diving" => Ok(Self::SingleGasDiving), + "multi_gas_diving" => Ok(Self::MultiGasDiving), + "gauge_diving" => Ok(Self::GaugeDiving), + "apnea_diving" => Ok(Self::ApneaDiving), + "apnea_hunting" => Ok(Self::ApneaHunting), + "virtual_activity" => Ok(Self::VirtualActivity), + "obstacle" => Ok(Self::Obstacle), + "breathing" => Ok(Self::Breathing), + "sail_race" => Ok(Self::SailRace), + "ultra" => Ok(Self::Ultra), + "indoor_climbing" => Ok(Self::IndoorClimbing), + "bouldering" => Ok(Self::Bouldering), + "hiit" => Ok(Self::Hiit), + "amrap" => Ok(Self::Amrap), + "emom" => Ok(Self::Emom), + "tabata" => Ok(Self::Tabata), + "pickleball" => Ok(Self::Pickleball), + "padel" => Ok(Self::Padel), + "indoor_wheelchair_walk" => Ok(Self::IndoorWheelchairWalk), + "indoor_wheelchair_run" => Ok(Self::IndoorWheelchairRun), + "indoor_hand_cycling" => Ok(Self::IndoorHandCycling), + "squash" => Ok(Self::Squash), + "badminton" => Ok(Self::Badminton), + "racquetball" => Ok(Self::Racquetball), + "table_tennis" => Ok(Self::TableTennis), + "fly_canopy" => Ok(Self::FlyCanopy), + "fly_paraglide" => Ok(Self::FlyParaglide), + "fly_paramotor" => Ok(Self::FlyParamotor), + "fly_pressurized" => Ok(Self::FlyPressurized), + "fly_navigate" => Ok(Self::FlyNavigate), + "fly_timer" => Ok(Self::FlyTimer), + "fly_altimeter" => Ok(Self::FlyAltimeter), + "fly_wx" => Ok(Self::FlyWx), + "fly_vfr" => Ok(Self::FlyVfr), + "fly_ifr" => Ok(Self::FlyIfr), + "all" => Ok(Self::All), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SubSport { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SportEvent { Uncategorized, @@ -4740,6 +5746,28 @@ impl Serialize for SportEvent { serializer.serialize_str(&self.to_string()) } } +impl FromStr for SportEvent { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "uncategorized" => Ok(Self::Uncategorized), + "geocaching" => Ok(Self::Geocaching), + "fitness" => Ok(Self::Fitness), + "recreation" => Ok(Self::Recreation), + "race" => Ok(Self::Race), + "special_event" => Ok(Self::SpecialEvent), + "training" => Ok(Self::Training), + "transportation" => Ok(Self::Transportation), + "touring" => Ok(Self::Touring), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SportEvent { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Activity { Manual, @@ -4796,6 +5824,21 @@ impl Serialize for Activity { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Activity { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "manual" => Ok(Self::Manual), + "auto_multi_sport" => Ok(Self::AutoMultiSport), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Activity { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Intensity { Active, @@ -4877,6 +5920,26 @@ impl Serialize for Intensity { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Intensity { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "active" => Ok(Self::Active), + "rest" => Ok(Self::Rest), + "warmup" => Ok(Self::Warmup), + "cooldown" => Ok(Self::Cooldown), + "recovery" => Ok(Self::Recovery), + "interval" => Ok(Self::Interval), + "other" => Ok(Self::Other), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Intensity { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SessionTrigger { ActivityEnd, @@ -4946,6 +6009,23 @@ impl Serialize for SessionTrigger { serializer.serialize_str(&self.to_string()) } } +impl FromStr for SessionTrigger { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "activity_end" => Ok(Self::ActivityEnd), + "manual" => Ok(Self::Manual), + "auto_multi_sport" => Ok(Self::AutoMultiSport), + "fitness_equipment" => Ok(Self::FitnessEquipment), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SessionTrigger { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum AutolapTrigger { Time, @@ -5027,6 +6107,26 @@ impl Serialize for AutolapTrigger { serializer.serialize_str(&self.to_string()) } } +impl FromStr for AutolapTrigger { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "time" => Ok(Self::Time), + "distance" => Ok(Self::Distance), + "position_start" => Ok(Self::PositionStart), + "position_lap" => Ok(Self::PositionLap), + "position_waypoint" => Ok(Self::PositionWaypoint), + "position_marked" => Ok(Self::PositionMarked), + "off" => Ok(Self::Off), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for AutolapTrigger { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LapTrigger { Manual, @@ -5118,6 +6218,28 @@ impl Serialize for LapTrigger { serializer.serialize_str(&self.to_string()) } } +impl FromStr for LapTrigger { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "manual" => Ok(Self::Manual), + "time" => Ok(Self::Time), + "distance" => Ok(Self::Distance), + "position_start" => Ok(Self::PositionStart), + "position_lap" => Ok(Self::PositionLap), + "position_waypoint" => Ok(Self::PositionWaypoint), + "position_marked" => Ok(Self::PositionMarked), + "session_end" => Ok(Self::SessionEnd), + "fitness_equipment" => Ok(Self::FitnessEquipment), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LapTrigger { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum TimeMode { Hour12, @@ -5196,6 +6318,25 @@ impl Serialize for TimeMode { serializer.serialize_str(&self.to_string()) } } +impl FromStr for TimeMode { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "hour12" => Ok(Self::Hour12), + "hour24" => Ok(Self::Hour24), + "military" => Ok(Self::Military), + "hour_12_with_seconds" => Ok(Self::Hour12WithSeconds), + "hour_24_with_seconds" => Ok(Self::Hour24WithSeconds), + "utc" => Ok(Self::Utc), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for TimeMode { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum BacklightMode { Off, @@ -5279,6 +6420,28 @@ impl Serialize for BacklightMode { serializer.serialize_str(&self.to_string()) } } +impl FromStr for BacklightMode { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "off" => Ok(Self::Off), + "manual" => Ok(Self::Manual), + "key_and_messages" => Ok(Self::KeyAndMessages), + "auto_brightness" => Ok(Self::AutoBrightness), + "smart_notifications" => Ok(Self::SmartNotifications), + "key_and_messages_night" => Ok(Self::KeyAndMessagesNight), + "key_and_messages_and_smart_notifications" => { + Ok(Self::KeyAndMessagesAndSmartNotifications) + } + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for BacklightMode { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DateMode { DayMonth, @@ -5335,6 +6498,21 @@ impl Serialize for DateMode { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DateMode { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "day_month" => Ok(Self::DayMonth), + "month_day" => Ok(Self::MonthDay), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DateMode { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// Timeout in seconds. #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum BacklightTimeout { @@ -5391,6 +6569,20 @@ impl Serialize for BacklightTimeout { } } } +impl FromStr for BacklightTimeout { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "infinite" => Ok(Self::Infinite), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for BacklightTimeout { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Event { /// Group 0. Start / stop_all @@ -5713,6 +6905,65 @@ impl Serialize for Event { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Event { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "timer" => Ok(Self::Timer), + "workout" => Ok(Self::Workout), + "workout_step" => Ok(Self::WorkoutStep), + "power_down" => Ok(Self::PowerDown), + "power_up" => Ok(Self::PowerUp), + "off_course" => Ok(Self::OffCourse), + "session" => Ok(Self::Session), + "lap" => Ok(Self::Lap), + "course_point" => Ok(Self::CoursePoint), + "battery" => Ok(Self::Battery), + "virtual_partner_pace" => Ok(Self::VirtualPartnerPace), + "hr_high_alert" => Ok(Self::HrHighAlert), + "hr_low_alert" => Ok(Self::HrLowAlert), + "speed_high_alert" => Ok(Self::SpeedHighAlert), + "speed_low_alert" => Ok(Self::SpeedLowAlert), + "cad_high_alert" => Ok(Self::CadHighAlert), + "cad_low_alert" => Ok(Self::CadLowAlert), + "power_high_alert" => Ok(Self::PowerHighAlert), + "power_low_alert" => Ok(Self::PowerLowAlert), + "recovery_hr" => Ok(Self::RecoveryHr), + "battery_low" => Ok(Self::BatteryLow), + "time_duration_alert" => Ok(Self::TimeDurationAlert), + "distance_duration_alert" => Ok(Self::DistanceDurationAlert), + "calorie_duration_alert" => Ok(Self::CalorieDurationAlert), + "activity" => Ok(Self::Activity), + "fitness_equipment" => Ok(Self::FitnessEquipment), + "length" => Ok(Self::Length), + "user_marker" => Ok(Self::UserMarker), + "sport_point" => Ok(Self::SportPoint), + "calibration" => Ok(Self::Calibration), + "front_gear_change" => Ok(Self::FrontGearChange), + "rear_gear_change" => Ok(Self::RearGearChange), + "rider_position_change" => Ok(Self::RiderPositionChange), + "elev_high_alert" => Ok(Self::ElevHighAlert), + "elev_low_alert" => Ok(Self::ElevLowAlert), + "comm_timeout" => Ok(Self::CommTimeout), + "auto_activity_detect" => Ok(Self::AutoActivityDetect), + "dive_alert" => Ok(Self::DiveAlert), + "dive_gas_switched" => Ok(Self::DiveGasSwitched), + "tank_pressure_reserve" => Ok(Self::TankPressureReserve), + "tank_pressure_critical" => Ok(Self::TankPressureCritical), + "tank_lost" => Ok(Self::TankLost), + "radar_threat_alert" => Ok(Self::RadarThreatAlert), + "tank_battery_low" => Ok(Self::TankBatteryLow), + "tank_pod_connected" => Ok(Self::TankPodConnected), + "tank_pod_disconnected" => Ok(Self::TankPodDisconnected), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Event { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum EventType { Start, @@ -5809,6 +7060,29 @@ impl Serialize for EventType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for EventType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "start" => Ok(Self::Start), + "stop" => Ok(Self::Stop), + "consecutive_depreciated" => Ok(Self::ConsecutiveDepreciated), + "marker" => Ok(Self::Marker), + "stop_all" => Ok(Self::StopAll), + "begin_depreciated" => Ok(Self::BeginDepreciated), + "end_depreciated" => Ok(Self::EndDepreciated), + "end_all_depreciated" => Ok(Self::EndAllDepreciated), + "stop_disable" => Ok(Self::StopDisable), + "stop_disable_all" => Ok(Self::StopDisableAll), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for EventType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// timer event data #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum TimerTrigger { @@ -5871,6 +7145,22 @@ impl Serialize for TimerTrigger { serializer.serialize_str(&self.to_string()) } } +impl FromStr for TimerTrigger { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "manual" => Ok(Self::Manual), + "auto" => Ok(Self::Auto), + "fitness_equipment" => Ok(Self::FitnessEquipment), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for TimerTrigger { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// fitness equipment event data #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum FitnessEquipmentState { @@ -5939,6 +7229,23 @@ impl Serialize for FitnessEquipmentState { serializer.serialize_str(&self.to_string()) } } +impl FromStr for FitnessEquipmentState { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "ready" => Ok(Self::Ready), + "in_use" => Ok(Self::InUse), + "paused" => Ok(Self::Paused), + "unknown" => Ok(Self::Unknown), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for FitnessEquipmentState { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Tone { Off, @@ -6005,6 +7312,23 @@ impl Serialize for Tone { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Tone { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "off" => Ok(Self::Off), + "tone" => Ok(Self::Tone), + "vibrate" => Ok(Self::Vibrate), + "tone_and_vibrate" => Ok(Self::ToneAndVibrate), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Tone { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Autoscroll { None, @@ -6071,6 +7395,23 @@ impl Serialize for Autoscroll { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Autoscroll { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "none" => Ok(Self::None), + "slow" => Ok(Self::Slow), + "medium" => Ok(Self::Medium), + "fast" => Ok(Self::Fast), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Autoscroll { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ActivityClass { LevelMax, @@ -6133,6 +7474,22 @@ impl Serialize for ActivityClass { serializer.serialize_str(&self.to_string()) } } +impl FromStr for ActivityClass { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "level_max" => Ok(Self::LevelMax), + "level" => Ok(Self::Level), + "athlete" => Ok(Self::Athlete), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ActivityClass { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum HrZoneCalc { Custom, @@ -6199,6 +7556,23 @@ impl Serialize for HrZoneCalc { serializer.serialize_str(&self.to_string()) } } +impl FromStr for HrZoneCalc { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "custom" => Ok(Self::Custom), + "percent_max_hr" => Ok(Self::PercentMaxHr), + "percent_hrr" => Ok(Self::PercentHrr), + "percent_lthr" => Ok(Self::PercentLthr), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for HrZoneCalc { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum PwrZoneCalc { Custom, @@ -6255,6 +7629,21 @@ impl Serialize for PwrZoneCalc { serializer.serialize_str(&self.to_string()) } } +impl FromStr for PwrZoneCalc { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "custom" => Ok(Self::Custom), + "percent_ftp" => Ok(Self::PercentFtp), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for PwrZoneCalc { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WktStepDuration { Time, @@ -6464,6 +7853,52 @@ impl Serialize for WktStepDuration { serializer.serialize_str(&self.to_string()) } } +impl FromStr for WktStepDuration { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "time" => Ok(Self::Time), + "distance" => Ok(Self::Distance), + "hr_less_than" => Ok(Self::HrLessThan), + "hr_greater_than" => Ok(Self::HrGreaterThan), + "calories" => Ok(Self::Calories), + "open" => Ok(Self::Open), + "repeat_until_steps_cmplt" => Ok(Self::RepeatUntilStepsCmplt), + "repeat_until_time" => Ok(Self::RepeatUntilTime), + "repeat_until_distance" => Ok(Self::RepeatUntilDistance), + "repeat_until_calories" => Ok(Self::RepeatUntilCalories), + "repeat_until_hr_less_than" => Ok(Self::RepeatUntilHrLessThan), + "repeat_until_hr_greater_than" => Ok(Self::RepeatUntilHrGreaterThan), + "repeat_until_power_less_than" => Ok(Self::RepeatUntilPowerLessThan), + "repeat_until_power_greater_than" => Ok(Self::RepeatUntilPowerGreaterThan), + "power_less_than" => Ok(Self::PowerLessThan), + "power_greater_than" => Ok(Self::PowerGreaterThan), + "training_peaks_tss" => Ok(Self::TrainingPeaksTss), + "repeat_until_power_last_lap_less_than" => Ok(Self::RepeatUntilPowerLastLapLessThan), + "repeat_until_max_power_last_lap_less_than" => { + Ok(Self::RepeatUntilMaxPowerLastLapLessThan) + } + "power_3s_less_than" => Ok(Self::Power3sLessThan), + "power_10s_less_than" => Ok(Self::Power10sLessThan), + "power_30s_less_than" => Ok(Self::Power30sLessThan), + "power_3s_greater_than" => Ok(Self::Power3sGreaterThan), + "power_10s_greater_than" => Ok(Self::Power10sGreaterThan), + "power_30s_greater_than" => Ok(Self::Power30sGreaterThan), + "power_lap_less_than" => Ok(Self::PowerLapLessThan), + "power_lap_greater_than" => Ok(Self::PowerLapGreaterThan), + "repeat_until_training_peaks_tss" => Ok(Self::RepeatUntilTrainingPeaksTss), + "repetition_time" => Ok(Self::RepetitionTime), + "reps" => Ok(Self::Reps), + "time_only" => Ok(Self::TimeOnly), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WktStepDuration { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WktStepTarget { Speed, @@ -6580,6 +8015,33 @@ impl Serialize for WktStepTarget { serializer.serialize_str(&self.to_string()) } } +impl FromStr for WktStepTarget { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "speed" => Ok(Self::Speed), + "heart_rate" => Ok(Self::HeartRate), + "open" => Ok(Self::Open), + "cadence" => Ok(Self::Cadence), + "power" => Ok(Self::Power), + "grade" => Ok(Self::Grade), + "resistance" => Ok(Self::Resistance), + "power_3s" => Ok(Self::Power3s), + "power_10s" => Ok(Self::Power10s), + "power_30s" => Ok(Self::Power30s), + "power_lap" => Ok(Self::PowerLap), + "swim_stroke" => Ok(Self::SwimStroke), + "speed_lap" => Ok(Self::SpeedLap), + "heart_rate_lap" => Ok(Self::HeartRateLap), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WktStepTarget { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Goal { Time, @@ -6661,6 +8123,26 @@ impl Serialize for Goal { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Goal { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "time" => Ok(Self::Time), + "distance" => Ok(Self::Distance), + "calories" => Ok(Self::Calories), + "frequency" => Ok(Self::Frequency), + "steps" => Ok(Self::Steps), + "ascent" => Ok(Self::Ascent), + "active_minutes" => Ok(Self::ActiveMinutes), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Goal { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum GoalRecurrence { Off, @@ -6737,6 +8219,25 @@ impl Serialize for GoalRecurrence { serializer.serialize_str(&self.to_string()) } } +impl FromStr for GoalRecurrence { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "off" => Ok(Self::Off), + "daily" => Ok(Self::Daily), + "weekly" => Ok(Self::Weekly), + "monthly" => Ok(Self::Monthly), + "yearly" => Ok(Self::Yearly), + "custom" => Ok(Self::Custom), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for GoalRecurrence { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum GoalSource { /// Device generated @@ -6801,6 +8302,22 @@ impl Serialize for GoalSource { serializer.serialize_str(&self.to_string()) } } +impl FromStr for GoalSource { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "auto" => Ok(Self::Auto), + "community" => Ok(Self::Community), + "user" => Ok(Self::User), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for GoalSource { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Schedule { Workout, @@ -6857,6 +8374,21 @@ impl Serialize for Schedule { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Schedule { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "workout" => Ok(Self::Workout), + "course" => Ok(Self::Course), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Schedule { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum CoursePoint { Generic, @@ -7169,6 +8701,72 @@ impl Serialize for CoursePoint { serializer.serialize_str(&self.to_string()) } } +impl FromStr for CoursePoint { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "generic" => Ok(Self::Generic), + "summit" => Ok(Self::Summit), + "valley" => Ok(Self::Valley), + "water" => Ok(Self::Water), + "food" => Ok(Self::Food), + "danger" => Ok(Self::Danger), + "left" => Ok(Self::Left), + "right" => Ok(Self::Right), + "straight" => Ok(Self::Straight), + "first_aid" => Ok(Self::FirstAid), + "fourth_category" => Ok(Self::FourthCategory), + "third_category" => Ok(Self::ThirdCategory), + "second_category" => Ok(Self::SecondCategory), + "first_category" => Ok(Self::FirstCategory), + "hors_category" => Ok(Self::HorsCategory), + "sprint" => Ok(Self::Sprint), + "left_fork" => Ok(Self::LeftFork), + "right_fork" => Ok(Self::RightFork), + "middle_fork" => Ok(Self::MiddleFork), + "slight_left" => Ok(Self::SlightLeft), + "sharp_left" => Ok(Self::SharpLeft), + "slight_right" => Ok(Self::SlightRight), + "sharp_right" => Ok(Self::SharpRight), + "u_turn" => Ok(Self::UTurn), + "segment_start" => Ok(Self::SegmentStart), + "segment_end" => Ok(Self::SegmentEnd), + "campsite" => Ok(Self::Campsite), + "aid_station" => Ok(Self::AidStation), + "rest_area" => Ok(Self::RestArea), + "general_distance" => Ok(Self::GeneralDistance), + "service" => Ok(Self::Service), + "energy_gel" => Ok(Self::EnergyGel), + "sports_drink" => Ok(Self::SportsDrink), + "mile_marker" => Ok(Self::MileMarker), + "checkpoint" => Ok(Self::Checkpoint), + "shelter" => Ok(Self::Shelter), + "meeting_spot" => Ok(Self::MeetingSpot), + "overlook" => Ok(Self::Overlook), + "toilet" => Ok(Self::Toilet), + "shower" => Ok(Self::Shower), + "gear" => Ok(Self::Gear), + "sharp_curve" => Ok(Self::SharpCurve), + "steep_incline" => Ok(Self::SteepIncline), + "tunnel" => Ok(Self::Tunnel), + "bridge" => Ok(Self::Bridge), + "obstacle" => Ok(Self::Obstacle), + "crossing" => Ok(Self::Crossing), + "store" => Ok(Self::Store), + "transition" => Ok(Self::Transition), + "navaid" => Ok(Self::Navaid), + "transport" => Ok(Self::Transport), + "alert" => Ok(Self::Alert), + "info" => Ok(Self::Info), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for CoursePoint { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Manufacturer { Garmin, @@ -8338,6 +9936,241 @@ impl Serialize for Manufacturer { } } } +impl FromStr for Manufacturer { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "garmin" => Ok(Self::Garmin), + "garmin_fr405_antfs" => Ok(Self::GarminFr405Antfs), + "zephyr" => Ok(Self::Zephyr), + "dayton" => Ok(Self::Dayton), + "idt" => Ok(Self::Idt), + "srm" => Ok(Self::Srm), + "quarq" => Ok(Self::Quarq), + "ibike" => Ok(Self::Ibike), + "saris" => Ok(Self::Saris), + "spark_hk" => Ok(Self::SparkHk), + "tanita" => Ok(Self::Tanita), + "echowell" => Ok(Self::Echowell), + "dynastream_oem" => Ok(Self::DynastreamOem), + "nautilus" => Ok(Self::Nautilus), + "dynastream" => Ok(Self::Dynastream), + "timex" => Ok(Self::Timex), + "metrigear" => Ok(Self::Metrigear), + "xelic" => Ok(Self::Xelic), + "beurer" => Ok(Self::Beurer), + "cardiosport" => Ok(Self::Cardiosport), + "a_and_d" => Ok(Self::AAndD), + "hmm" => Ok(Self::Hmm), + "suunto" => Ok(Self::Suunto), + "thita_elektronik" => Ok(Self::ThitaElektronik), + "gpulse" => Ok(Self::Gpulse), + "clean_mobile" => Ok(Self::CleanMobile), + "pedal_brain" => Ok(Self::PedalBrain), + "peaksware" => Ok(Self::Peaksware), + "saxonar" => Ok(Self::Saxonar), + "lemond_fitness" => Ok(Self::LemondFitness), + "dexcom" => Ok(Self::Dexcom), + "wahoo_fitness" => Ok(Self::WahooFitness), + "octane_fitness" => Ok(Self::OctaneFitness), + "archinoetics" => Ok(Self::Archinoetics), + "the_hurt_box" => Ok(Self::TheHurtBox), + "citizen_systems" => Ok(Self::CitizenSystems), + "magellan" => Ok(Self::Magellan), + "osynce" => Ok(Self::Osynce), + "holux" => Ok(Self::Holux), + "concept2" => Ok(Self::Concept2), + "shimano" => Ok(Self::Shimano), + "one_giant_leap" => Ok(Self::OneGiantLeap), + "ace_sensor" => Ok(Self::AceSensor), + "brim_brothers" => Ok(Self::BrimBrothers), + "xplova" => Ok(Self::Xplova), + "perception_digital" => Ok(Self::PerceptionDigital), + "bf1systems" => Ok(Self::Bf1systems), + "pioneer" => Ok(Self::Pioneer), + "spantec" => Ok(Self::Spantec), + "metalogics" => Ok(Self::Metalogics), + "4iiiis" => Ok(Self::Name4iiiis), + "seiko_epson" => Ok(Self::SeikoEpson), + "seiko_epson_oem" => Ok(Self::SeikoEpsonOem), + "ifor_powell" => Ok(Self::IforPowell), + "maxwell_guider" => Ok(Self::MaxwellGuider), + "star_trac" => Ok(Self::StarTrac), + "breakaway" => Ok(Self::Breakaway), + "alatech_technology_ltd" => Ok(Self::AlatechTechnologyLtd), + "mio_technology_europe" => Ok(Self::MioTechnologyEurope), + "rotor" => Ok(Self::Rotor), + "geonaute" => Ok(Self::Geonaute), + "id_bike" => Ok(Self::IdBike), + "specialized" => Ok(Self::Specialized), + "wtek" => Ok(Self::Wtek), + "physical_enterprises" => Ok(Self::PhysicalEnterprises), + "north_pole_engineering" => Ok(Self::NorthPoleEngineering), + "bkool" => Ok(Self::Bkool), + "cateye" => Ok(Self::Cateye), + "stages_cycling" => Ok(Self::StagesCycling), + "sigmasport" => Ok(Self::Sigmasport), + "tomtom" => Ok(Self::Tomtom), + "peripedal" => Ok(Self::Peripedal), + "wattbike" => Ok(Self::Wattbike), + "moxy" => Ok(Self::Moxy), + "ciclosport" => Ok(Self::Ciclosport), + "powerbahn" => Ok(Self::Powerbahn), + "acorn_projects_aps" => Ok(Self::AcornProjectsAps), + "lifebeam" => Ok(Self::Lifebeam), + "bontrager" => Ok(Self::Bontrager), + "wellgo" => Ok(Self::Wellgo), + "scosche" => Ok(Self::Scosche), + "magura" => Ok(Self::Magura), + "woodway" => Ok(Self::Woodway), + "elite" => Ok(Self::Elite), + "nielsen_kellerman" => Ok(Self::NielsenKellerman), + "dk_city" => Ok(Self::DkCity), + "tacx" => Ok(Self::Tacx), + "direction_technology" => Ok(Self::DirectionTechnology), + "magtonic" => Ok(Self::Magtonic), + "1partcarbon" => Ok(Self::Name1partcarbon), + "inside_ride_technologies" => Ok(Self::InsideRideTechnologies), + "sound_of_motion" => Ok(Self::SoundOfMotion), + "stryd" => Ok(Self::Stryd), + "icg" => Ok(Self::Icg), + "MiPulse" => Ok(Self::MiPulse), + "bsx_athletics" => Ok(Self::BsxAthletics), + "look" => Ok(Self::Look), + "campagnolo_srl" => Ok(Self::CampagnoloSrl), + "body_bike_smart" => Ok(Self::BodyBikeSmart), + "praxisworks" => Ok(Self::Praxisworks), + "limits_technology" => Ok(Self::LimitsTechnology), + "topaction_technology" => Ok(Self::TopactionTechnology), + "cosinuss" => Ok(Self::Cosinuss), + "fitcare" => Ok(Self::Fitcare), + "magene" => Ok(Self::Magene), + "giant_manufacturing_co" => Ok(Self::GiantManufacturingCo), + "tigrasport" => Ok(Self::Tigrasport), + "salutron" => Ok(Self::Salutron), + "technogym" => Ok(Self::Technogym), + "bryton_sensors" => Ok(Self::BrytonSensors), + "latitude_limited" => Ok(Self::LatitudeLimited), + "soaring_technology" => Ok(Self::SoaringTechnology), + "igpsport" => Ok(Self::Igpsport), + "thinkrider" => Ok(Self::Thinkrider), + "gopher_sport" => Ok(Self::GopherSport), + "waterrower" => Ok(Self::Waterrower), + "orangetheory" => Ok(Self::Orangetheory), + "inpeak" => Ok(Self::Inpeak), + "kinetic" => Ok(Self::Kinetic), + "johnson_health_tech" => Ok(Self::JohnsonHealthTech), + "polar_electro" => Ok(Self::PolarElectro), + "seesense" => Ok(Self::Seesense), + "nci_technology" => Ok(Self::NciTechnology), + "iqsquare" => Ok(Self::Iqsquare), + "leomo" => Ok(Self::Leomo), + "ifit_com" => Ok(Self::IfitCom), + "coros_byte" => Ok(Self::CorosByte), + "versa_design" => Ok(Self::VersaDesign), + "chileaf" => Ok(Self::Chileaf), + "cycplus" => Ok(Self::Cycplus), + "gravaa_byte" => Ok(Self::GravaaByte), + "sigeyi" => Ok(Self::Sigeyi), + "coospo" => Ok(Self::Coospo), + "geoid" => Ok(Self::Geoid), + "bosch" => Ok(Self::Bosch), + "kyto" => Ok(Self::Kyto), + "kinetic_sports" => Ok(Self::KineticSports), + "decathlon_byte" => Ok(Self::DecathlonByte), + "tq_systems" => Ok(Self::TqSystems), + "tag_heuer" => Ok(Self::TagHeuer), + "keiser_fitness" => Ok(Self::KeiserFitness), + "zwift_byte" => Ok(Self::ZwiftByte), + "porsche_ep" => Ok(Self::PorscheEp), + "blackbird" => Ok(Self::Blackbird), + "meilan_byte" => Ok(Self::MeilanByte), + "ezon" => Ok(Self::Ezon), + "laisi" => Ok(Self::Laisi), + "myzone" => Ok(Self::Myzone), + "development" => Ok(Self::Development), + "healthandlife" => Ok(Self::Healthandlife), + "lezyne" => Ok(Self::Lezyne), + "scribe_labs" => Ok(Self::ScribeLabs), + "zwift" => Ok(Self::Zwift), + "watteam" => Ok(Self::Watteam), + "recon" => Ok(Self::Recon), + "favero_electronics" => Ok(Self::FaveroElectronics), + "dynovelo" => Ok(Self::Dynovelo), + "strava" => Ok(Self::Strava), + "precor" => Ok(Self::Precor), + "bryton" => Ok(Self::Bryton), + "sram" => Ok(Self::Sram), + "navman" => Ok(Self::Navman), + "cobi" => Ok(Self::Cobi), + "spivi" => Ok(Self::Spivi), + "mio_magellan" => Ok(Self::MioMagellan), + "evesports" => Ok(Self::Evesports), + "sensitivus_gauge" => Ok(Self::SensitivusGauge), + "podoon" => Ok(Self::Podoon), + "life_time_fitness" => Ok(Self::LifeTimeFitness), + "falco_e_motors" => Ok(Self::FalcoEMotors), + "minoura" => Ok(Self::Minoura), + "cycliq" => Ok(Self::Cycliq), + "luxottica" => Ok(Self::Luxottica), + "trainer_road" => Ok(Self::TrainerRoad), + "the_sufferfest" => Ok(Self::TheSufferfest), + "fullspeedahead" => Ok(Self::Fullspeedahead), + "virtualtraining" => Ok(Self::Virtualtraining), + "feedbacksports" => Ok(Self::Feedbacksports), + "omata" => Ok(Self::Omata), + "vdo" => Ok(Self::Vdo), + "magneticdays" => Ok(Self::Magneticdays), + "hammerhead" => Ok(Self::Hammerhead), + "kinetic_by_kurt" => Ok(Self::KineticByKurt), + "shapelog" => Ok(Self::Shapelog), + "dabuziduo" => Ok(Self::Dabuziduo), + "jetblack" => Ok(Self::Jetblack), + "coros" => Ok(Self::Coros), + "virtugo" => Ok(Self::Virtugo), + "velosense" => Ok(Self::Velosense), + "cycligentinc" => Ok(Self::Cycligentinc), + "trailforks" => Ok(Self::Trailforks), + "mahle_ebikemotion" => Ok(Self::MahleEbikemotion), + "nurvv" => Ok(Self::Nurvv), + "microprogram" => Ok(Self::Microprogram), + "zone5cloud" => Ok(Self::Zone5cloud), + "greenteg" => Ok(Self::Greenteg), + "yamaha_motors" => Ok(Self::YamahaMotors), + "whoop" => Ok(Self::Whoop), + "gravaa" => Ok(Self::Gravaa), + "onelap" => Ok(Self::Onelap), + "monark_exercise" => Ok(Self::MonarkExercise), + "form" => Ok(Self::Form), + "decathlon" => Ok(Self::Decathlon), + "syncros" => Ok(Self::Syncros), + "heatup" => Ok(Self::Heatup), + "cannondale" => Ok(Self::Cannondale), + "true_fitness" => Ok(Self::TrueFitness), + "RGT_cycling" => Ok(Self::RGTCycling), + "vasa" => Ok(Self::Vasa), + "race_republic" => Ok(Self::RaceRepublic), + "fazua" => Ok(Self::Fazua), + "oreka_training" => Ok(Self::OrekaTraining), + "lsec" => Ok(Self::Lsec), + "lululemon_studio" => Ok(Self::LululemonStudio), + "shanyue" => Ok(Self::Shanyue), + "spinning_mda" => Ok(Self::SpinningMda), + "hilldating" => Ok(Self::Hilldating), + "aero_sensor" => Ok(Self::AeroSensor), + "nike" => Ok(Self::Nike), + "magicshine" => Ok(Self::Magicshine), + "ictrainer" => Ok(Self::Ictrainer), + "actigraphcorp" => Ok(Self::Actigraphcorp), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Manufacturer { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum GarminProduct { ApproachG12Asia, @@ -10590,6 +12423,450 @@ impl Serialize for GarminProduct { } } } +impl FromStr for GarminProduct { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "approach_g12_asia" => Ok(Self::ApproachG12Asia), + "axh01" => Ok(Self::Axh01), + "axb01" => Ok(Self::Axb01), + "axb02" => Ok(Self::Axb02), + "hrm2ss" => Ok(Self::Hrm2ss), + "dsi_alf02" => Ok(Self::DsiAlf02), + "hrm3ss" => Ok(Self::Hrm3ss), + "hrm_run_single_byte_product_id" => Ok(Self::HrmRunSingleByteProductId), + "bsm" => Ok(Self::Bsm), + "bcm" => Ok(Self::Bcm), + "axs01" => Ok(Self::Axs01), + "hrm_tri_single_byte_product_id" => Ok(Self::HrmTriSingleByteProductId), + "hrm4_run_single_byte_product_id" => Ok(Self::Hrm4RunSingleByteProductId), + "fr225_single_byte_product_id" => Ok(Self::Fr225SingleByteProductId), + "gen3_bsm_single_byte_product_id" => Ok(Self::Gen3BsmSingleByteProductId), + "gen3_bcm_single_byte_product_id" => Ok(Self::Gen3BcmSingleByteProductId), + "hrm_fit_single_byte_product_id" => Ok(Self::HrmFitSingleByteProductId), + "OHR" => Ok(Self::OHR), + "fr301_china" => Ok(Self::Fr301China), + "fr301_japan" => Ok(Self::Fr301Japan), + "fr301_korea" => Ok(Self::Fr301Korea), + "fr301_taiwan" => Ok(Self::Fr301Taiwan), + "fr405" => Ok(Self::Fr405), + "fr50" => Ok(Self::Fr50), + "fr405_japan" => Ok(Self::Fr405Japan), + "fr60" => Ok(Self::Fr60), + "dsi_alf01" => Ok(Self::DsiAlf01), + "fr310xt" => Ok(Self::Fr310xt), + "edge500" => Ok(Self::Edge500), + "fr110" => Ok(Self::Fr110), + "edge800" => Ok(Self::Edge800), + "edge500_taiwan" => Ok(Self::Edge500Taiwan), + "edge500_japan" => Ok(Self::Edge500Japan), + "chirp" => Ok(Self::Chirp), + "fr110_japan" => Ok(Self::Fr110Japan), + "edge200" => Ok(Self::Edge200), + "fr910xt" => Ok(Self::Fr910xt), + "edge800_taiwan" => Ok(Self::Edge800Taiwan), + "edge800_japan" => Ok(Self::Edge800Japan), + "alf04" => Ok(Self::Alf04), + "fr610" => Ok(Self::Fr610), + "fr210_japan" => Ok(Self::Fr210Japan), + "vector_ss" => Ok(Self::VectorSs), + "vector_cp" => Ok(Self::VectorCp), + "edge800_china" => Ok(Self::Edge800China), + "edge500_china" => Ok(Self::Edge500China), + "approach_g10" => Ok(Self::ApproachG10), + "fr610_japan" => Ok(Self::Fr610Japan), + "edge500_korea" => Ok(Self::Edge500Korea), + "fr70" => Ok(Self::Fr70), + "fr310xt_4t" => Ok(Self::Fr310xt4t), + "amx" => Ok(Self::Amx), + "fr10" => Ok(Self::Fr10), + "edge800_korea" => Ok(Self::Edge800Korea), + "swim" => Ok(Self::Swim), + "fr910xt_china" => Ok(Self::Fr910xtChina), + "fenix" => Ok(Self::Fenix), + "edge200_taiwan" => Ok(Self::Edge200Taiwan), + "edge510" => Ok(Self::Edge510), + "edge810" => Ok(Self::Edge810), + "tempe" => Ok(Self::Tempe), + "fr910xt_japan" => Ok(Self::Fr910xtJapan), + "fr620" => Ok(Self::Fr620), + "fr220" => Ok(Self::Fr220), + "fr910xt_korea" => Ok(Self::Fr910xtKorea), + "fr10_japan" => Ok(Self::Fr10Japan), + "edge810_japan" => Ok(Self::Edge810Japan), + "virb_elite" => Ok(Self::VirbElite), + "edge_touring" => Ok(Self::EdgeTouring), + "edge510_japan" => Ok(Self::Edge510Japan), + "hrm_tri" => Ok(Self::HrmTri), + "hrm_run" => Ok(Self::HrmRun), + "fr920xt" => Ok(Self::Fr920xt), + "edge510_asia" => Ok(Self::Edge510Asia), + "edge810_china" => Ok(Self::Edge810China), + "edge810_taiwan" => Ok(Self::Edge810Taiwan), + "edge1000" => Ok(Self::Edge1000), + "vivo_fit" => Ok(Self::VivoFit), + "virb_remote" => Ok(Self::VirbRemote), + "vivo_ki" => Ok(Self::VivoKi), + "fr15" => Ok(Self::Fr15), + "vivo_active" => Ok(Self::VivoActive), + "edge510_korea" => Ok(Self::Edge510Korea), + "fr620_japan" => Ok(Self::Fr620Japan), + "fr620_china" => Ok(Self::Fr620China), + "fr220_japan" => Ok(Self::Fr220Japan), + "fr220_china" => Ok(Self::Fr220China), + "approach_s6" => Ok(Self::ApproachS6), + "vivo_smart" => Ok(Self::VivoSmart), + "fenix2" => Ok(Self::Fenix2), + "epix" => Ok(Self::Epix), + "fenix3" => Ok(Self::Fenix3), + "edge1000_taiwan" => Ok(Self::Edge1000Taiwan), + "edge1000_japan" => Ok(Self::Edge1000Japan), + "fr15_japan" => Ok(Self::Fr15Japan), + "edge520" => Ok(Self::Edge520), + "edge1000_china" => Ok(Self::Edge1000China), + "fr620_russia" => Ok(Self::Fr620Russia), + "fr220_russia" => Ok(Self::Fr220Russia), + "vector_s" => Ok(Self::VectorS), + "edge1000_korea" => Ok(Self::Edge1000Korea), + "fr920xt_taiwan" => Ok(Self::Fr920xtTaiwan), + "fr920xt_china" => Ok(Self::Fr920xtChina), + "fr920xt_japan" => Ok(Self::Fr920xtJapan), + "virbx" => Ok(Self::Virbx), + "vivo_smart_apac" => Ok(Self::VivoSmartApac), + "etrex_touch" => Ok(Self::EtrexTouch), + "edge25" => Ok(Self::Edge25), + "fr25" => Ok(Self::Fr25), + "vivo_fit2" => Ok(Self::VivoFit2), + "fr225" => Ok(Self::Fr225), + "fr630" => Ok(Self::Fr630), + "fr230" => Ok(Self::Fr230), + "fr735xt" => Ok(Self::Fr735xt), + "vivo_active_apac" => Ok(Self::VivoActiveApac), + "vector_2" => Ok(Self::Vector2), + "vector_2s" => Ok(Self::Vector2s), + "virbxe" => Ok(Self::Virbxe), + "fr620_taiwan" => Ok(Self::Fr620Taiwan), + "fr220_taiwan" => Ok(Self::Fr220Taiwan), + "truswing" => Ok(Self::Truswing), + "d2airvenu" => Ok(Self::D2airvenu), + "fenix3_china" => Ok(Self::Fenix3China), + "fenix3_twn" => Ok(Self::Fenix3Twn), + "varia_headlight" => Ok(Self::VariaHeadlight), + "varia_taillight_old" => Ok(Self::VariaTaillightOld), + "edge_explore_1000" => Ok(Self::EdgeExplore1000), + "fr225_asia" => Ok(Self::Fr225Asia), + "varia_radar_taillight" => Ok(Self::VariaRadarTaillight), + "varia_radar_display" => Ok(Self::VariaRadarDisplay), + "edge20" => Ok(Self::Edge20), + "edge520_asia" => Ok(Self::Edge520Asia), + "edge520_japan" => Ok(Self::Edge520Japan), + "d2_bravo" => Ok(Self::D2Bravo), + "approach_s20" => Ok(Self::ApproachS20), + "vivo_smart2" => Ok(Self::VivoSmart2), + "edge1000_thai" => Ok(Self::Edge1000Thai), + "varia_remote" => Ok(Self::VariaRemote), + "edge25_asia" => Ok(Self::Edge25Asia), + "edge25_jpn" => Ok(Self::Edge25Jpn), + "edge20_asia" => Ok(Self::Edge20Asia), + "approach_x40" => Ok(Self::ApproachX40), + "fenix3_japan" => Ok(Self::Fenix3Japan), + "vivo_smart_emea" => Ok(Self::VivoSmartEmea), + "fr630_asia" => Ok(Self::Fr630Asia), + "fr630_jpn" => Ok(Self::Fr630Jpn), + "fr230_jpn" => Ok(Self::Fr230Jpn), + "hrm4_run" => Ok(Self::Hrm4Run), + "epix_japan" => Ok(Self::EpixJapan), + "vivo_active_hr" => Ok(Self::VivoActiveHr), + "approach_g12" => Ok(Self::ApproachG12), + "vivo_smart_gps_hr" => Ok(Self::VivoSmartGpsHr), + "vivo_smart_hr" => Ok(Self::VivoSmartHr), + "vivo_smart_hr_asia" => Ok(Self::VivoSmartHrAsia), + "vivo_smart_gps_hr_asia" => Ok(Self::VivoSmartGpsHrAsia), + "vivo_move" => Ok(Self::VivoMove), + "varia_taillight" => Ok(Self::VariaTaillight), + "fr235_asia" => Ok(Self::Fr235Asia), + "fr235_japan" => Ok(Self::Fr235Japan), + "varia_vision" => Ok(Self::VariaVision), + "vivo_fit3" => Ok(Self::VivoFit3), + "fenix3_korea" => Ok(Self::Fenix3Korea), + "fenix3_sea" => Ok(Self::Fenix3Sea), + "fenix3_hr" => Ok(Self::Fenix3Hr), + "virb_ultra_30" => Ok(Self::VirbUltra30), + "index_smart_scale" => Ok(Self::IndexSmartScale), + "fr235" => Ok(Self::Fr235), + "fenix3_chronos" => Ok(Self::Fenix3Chronos), + "oregon7xx" => Ok(Self::Oregon7xx), + "rino7xx" => Ok(Self::Rino7xx), + "epix_korea" => Ok(Self::EpixKorea), + "fenix3_hr_chn" => Ok(Self::Fenix3HrChn), + "fenix3_hr_twn" => Ok(Self::Fenix3HrTwn), + "fenix3_hr_jpn" => Ok(Self::Fenix3HrJpn), + "fenix3_hr_sea" => Ok(Self::Fenix3HrSea), + "fenix3_hr_kor" => Ok(Self::Fenix3HrKor), + "nautix" => Ok(Self::Nautix), + "vivo_active_hr_apac" => Ok(Self::VivoActiveHrApac), + "fr35" => Ok(Self::Fr35), + "oregon7xx_ww" => Ok(Self::Oregon7xxWw), + "edge_820" => Ok(Self::Edge820), + "edge_explore_820" => Ok(Self::EdgeExplore820), + "fr735xt_apac" => Ok(Self::Fr735xtApac), + "fr735xt_japan" => Ok(Self::Fr735xtJapan), + "fenix5s" => Ok(Self::Fenix5s), + "d2_bravo_titanium" => Ok(Self::D2BravoTitanium), + "varia_ut800" => Ok(Self::VariaUt800), + "running_dynamics_pod" => Ok(Self::RunningDynamicsPod), + "edge_820_china" => Ok(Self::Edge820China), + "edge_820_japan" => Ok(Self::Edge820Japan), + "fenix5x" => Ok(Self::Fenix5x), + "vivo_fit_jr" => Ok(Self::VivoFitJr), + "vivo_smart3" => Ok(Self::VivoSmart3), + "vivo_sport" => Ok(Self::VivoSport), + "edge_820_taiwan" => Ok(Self::Edge820Taiwan), + "edge_820_korea" => Ok(Self::Edge820Korea), + "edge_820_sea" => Ok(Self::Edge820Sea), + "fr35_hebrew" => Ok(Self::Fr35Hebrew), + "approach_s60" => Ok(Self::ApproachS60), + "fr35_apac" => Ok(Self::Fr35Apac), + "fr35_japan" => Ok(Self::Fr35Japan), + "fenix3_chronos_asia" => Ok(Self::Fenix3ChronosAsia), + "virb_360" => Ok(Self::Virb360), + "fr935" => Ok(Self::Fr935), + "fenix5" => Ok(Self::Fenix5), + "vivoactive3" => Ok(Self::Vivoactive3), + "edge_1030" => Ok(Self::Edge1030), + "fr35_sea" => Ok(Self::Fr35Sea), + "fr235_china_nfc" => Ok(Self::Fr235ChinaNfc), + "foretrex_601_701" => Ok(Self::Foretrex601701), + "vivo_move_hr" => Ok(Self::VivoMoveHr), + "vector_3" => Ok(Self::Vector3), + "fenix5_asia" => Ok(Self::Fenix5Asia), + "fenix5s_asia" => Ok(Self::Fenix5sAsia), + "fenix5x_asia" => Ok(Self::Fenix5xAsia), + "approach_z80" => Ok(Self::ApproachZ80), + "fr35_korea" => Ok(Self::Fr35Korea), + "d2charlie" => Ok(Self::D2charlie), + "vivo_smart3_apac" => Ok(Self::VivoSmart3Apac), + "vivo_sport_apac" => Ok(Self::VivoSportApac), + "fr935_asia" => Ok(Self::Fr935Asia), + "descent" => Ok(Self::Descent), + "vivo_fit4" => Ok(Self::VivoFit4), + "fr645" => Ok(Self::Fr645), + "fr645m" => Ok(Self::Fr645m), + "fr30" => Ok(Self::Fr30), + "fenix5s_plus" => Ok(Self::Fenix5sPlus), + "Edge_130" => Ok(Self::Edge130), + "edge_1030_asia" => Ok(Self::Edge1030Asia), + "vivosmart_4" => Ok(Self::Vivosmart4), + "vivo_move_hr_asia" => Ok(Self::VivoMoveHrAsia), + "approach_x10" => Ok(Self::ApproachX10), + "fr30_asia" => Ok(Self::Fr30Asia), + "vivoactive3m_w" => Ok(Self::Vivoactive3mW), + "fr645_asia" => Ok(Self::Fr645Asia), + "fr645m_asia" => Ok(Self::Fr645mAsia), + "edge_explore" => Ok(Self::EdgeExplore), + "gpsmap66" => Ok(Self::Gpsmap66), + "approach_s10" => Ok(Self::ApproachS10), + "vivoactive3m_l" => Ok(Self::Vivoactive3mL), + "approach_g80" => Ok(Self::ApproachG80), + "edge_130_asia" => Ok(Self::Edge130Asia), + "edge_1030_bontrager" => Ok(Self::Edge1030Bontrager), + "fenix5_plus" => Ok(Self::Fenix5Plus), + "fenix5x_plus" => Ok(Self::Fenix5xPlus), + "edge_520_plus" => Ok(Self::Edge520Plus), + "fr945" => Ok(Self::Fr945), + "edge_530" => Ok(Self::Edge530), + "edge_830" => Ok(Self::Edge830), + "instinct_esports" => Ok(Self::InstinctEsports), + "fenix5s_plus_apac" => Ok(Self::Fenix5sPlusApac), + "fenix5x_plus_apac" => Ok(Self::Fenix5xPlusApac), + "edge_520_plus_apac" => Ok(Self::Edge520PlusApac), + "descent_t1" => Ok(Self::DescentT1), + "fr235l_asia" => Ok(Self::Fr235lAsia), + "fr245_asia" => Ok(Self::Fr245Asia), + "vivo_active3m_apac" => Ok(Self::VivoActive3mApac), + "gen3_bsm" => Ok(Self::Gen3Bsm), + "gen3_bcm" => Ok(Self::Gen3Bcm), + "vivo_smart4_asia" => Ok(Self::VivoSmart4Asia), + "vivoactive4_small" => Ok(Self::Vivoactive4Small), + "vivoactive4_large" => Ok(Self::Vivoactive4Large), + "venu" => Ok(Self::Venu), + "marq_driver" => Ok(Self::MarqDriver), + "marq_aviator" => Ok(Self::MarqAviator), + "marq_captain" => Ok(Self::MarqCaptain), + "marq_commander" => Ok(Self::MarqCommander), + "marq_expedition" => Ok(Self::MarqExpedition), + "marq_athlete" => Ok(Self::MarqAthlete), + "descent_mk2" => Ok(Self::DescentMk2), + "gpsmap66i" => Ok(Self::Gpsmap66i), + "fenix6S_sport" => Ok(Self::Fenix6SSport), + "fenix6S" => Ok(Self::Fenix6S), + "fenix6_sport" => Ok(Self::Fenix6Sport), + "fenix6" => Ok(Self::Fenix6), + "fenix6x" => Ok(Self::Fenix6x), + "hrm_dual" => Ok(Self::HrmDual), + "hrm_pro" => Ok(Self::HrmPro), + "vivo_move3_premium" => Ok(Self::VivoMove3Premium), + "approach_s40" => Ok(Self::ApproachS40), + "fr245m_asia" => Ok(Self::Fr245mAsia), + "edge_530_apac" => Ok(Self::Edge530Apac), + "edge_830_apac" => Ok(Self::Edge830Apac), + "vivo_move3" => Ok(Self::VivoMove3), + "vivo_active4_small_asia" => Ok(Self::VivoActive4SmallAsia), + "vivo_active4_large_asia" => Ok(Self::VivoActive4LargeAsia), + "vivo_active4_oled_asia" => Ok(Self::VivoActive4OledAsia), + "swim2" => Ok(Self::Swim2), + "marq_driver_asia" => Ok(Self::MarqDriverAsia), + "marq_aviator_asia" => Ok(Self::MarqAviatorAsia), + "vivo_move3_asia" => Ok(Self::VivoMove3Asia), + "fr945_asia" => Ok(Self::Fr945Asia), + "vivo_active3t_chn" => Ok(Self::VivoActive3tChn), + "marq_captain_asia" => Ok(Self::MarqCaptainAsia), + "marq_commander_asia" => Ok(Self::MarqCommanderAsia), + "marq_expedition_asia" => Ok(Self::MarqExpeditionAsia), + "marq_athlete_asia" => Ok(Self::MarqAthleteAsia), + "instinct_solar" => Ok(Self::InstinctSolar), + "fr45_asia" => Ok(Self::Fr45Asia), + "vivoactive3_daimler" => Ok(Self::Vivoactive3Daimler), + "legacy_rey" => Ok(Self::LegacyRey), + "legacy_darth_vader" => Ok(Self::LegacyDarthVader), + "legacy_captain_marvel" => Ok(Self::LegacyCaptainMarvel), + "legacy_first_avenger" => Ok(Self::LegacyFirstAvenger), + "fenix6s_sport_asia" => Ok(Self::Fenix6sSportAsia), + "fenix6s_asia" => Ok(Self::Fenix6sAsia), + "fenix6_sport_asia" => Ok(Self::Fenix6SportAsia), + "fenix6_asia" => Ok(Self::Fenix6Asia), + "fenix6x_asia" => Ok(Self::Fenix6xAsia), + "legacy_captain_marvel_asia" => Ok(Self::LegacyCaptainMarvelAsia), + "legacy_first_avenger_asia" => Ok(Self::LegacyFirstAvengerAsia), + "legacy_rey_asia" => Ok(Self::LegacyReyAsia), + "legacy_darth_vader_asia" => Ok(Self::LegacyDarthVaderAsia), + "descent_mk2s" => Ok(Self::DescentMk2s), + "edge_130_plus" => Ok(Self::Edge130Plus), + "edge_1030_plus" => Ok(Self::Edge1030Plus), + "rally_200" => Ok(Self::Rally200), + "fr745" => Ok(Self::Fr745), + "venusq" => Ok(Self::Venusq), + "lily" => Ok(Self::Lily), + "marq_adventurer" => Ok(Self::MarqAdventurer), + "enduro" => Ok(Self::Enduro), + "swim2_apac" => Ok(Self::Swim2Apac), + "marq_adventurer_asia" => Ok(Self::MarqAdventurerAsia), + "fr945_lte" => Ok(Self::Fr945Lte), + "descent_mk2_asia" => Ok(Self::DescentMk2Asia), + "venu2" => Ok(Self::Venu2), + "venu2s" => Ok(Self::Venu2s), + "venu_daimler_asia" => Ok(Self::VenuDaimlerAsia), + "marq_golfer" => Ok(Self::MarqGolfer), + "venu_daimler" => Ok(Self::VenuDaimler), + "fr745_asia" => Ok(Self::Fr745Asia), + "varia_rct715" => Ok(Self::VariaRct715), + "lily_asia" => Ok(Self::LilyAsia), + "edge_1030_plus_asia" => Ok(Self::Edge1030PlusAsia), + "edge_130_plus_asia" => Ok(Self::Edge130PlusAsia), + "approach_s12" => Ok(Self::ApproachS12), + "venusq_asia" => Ok(Self::VenusqAsia), + "edge_1040" => Ok(Self::Edge1040), + "marq_golfer_asia" => Ok(Self::MarqGolferAsia), + "venu2_plus" => Ok(Self::Venu2Plus), + "gnss" => Ok(Self::Gnss), + "fr55" => Ok(Self::Fr55), + "enduro_asia" => Ok(Self::EnduroAsia), + "instinct_2" => Ok(Self::Instinct2), + "fenix7s" => Ok(Self::Fenix7s), + "fenix7" => Ok(Self::Fenix7), + "fenix7x" => Ok(Self::Fenix7x), + "fenix7s_apac" => Ok(Self::Fenix7sApac), + "fenix7_apac" => Ok(Self::Fenix7Apac), + "fenix7x_apac" => Ok(Self::Fenix7xApac), + "descent_mk2s_asia" => Ok(Self::DescentMk2sAsia), + "approach_s42" => Ok(Self::ApproachS42), + "epix_gen2" => Ok(Self::EpixGen2), + "epix_gen2_apac" => Ok(Self::EpixGen2Apac), + "venu2s_asia" => Ok(Self::Venu2sAsia), + "venu2_asia" => Ok(Self::Venu2Asia), + "fr945_lte_asia" => Ok(Self::Fr945LteAsia), + "vivo_move_sport" => Ok(Self::VivoMoveSport), + "vivomove_trend" => Ok(Self::VivomoveTrend), + "approach_S12_asia" => Ok(Self::ApproachS12Asia), + "fr255_music" => Ok(Self::Fr255Music), + "fr255_small_music" => Ok(Self::Fr255SmallMusic), + "fr255" => Ok(Self::Fr255), + "fr255_small" => Ok(Self::Fr255Small), + "approach_s42_asia" => Ok(Self::ApproachS42Asia), + "descent_g1" => Ok(Self::DescentG1), + "venu2_plus_asia" => Ok(Self::Venu2PlusAsia), + "fr955" => Ok(Self::Fr955), + "fr55_asia" => Ok(Self::Fr55Asia), + "edge_540" => Ok(Self::Edge540), + "edge_840" => Ok(Self::Edge840), + "vivosmart_5" => Ok(Self::Vivosmart5), + "instinct_2_asia" => Ok(Self::Instinct2Asia), + "marq_gen2" => Ok(Self::MarqGen2), + "venusq2" => Ok(Self::Venusq2), + "venusq2music" => Ok(Self::Venusq2music), + "marq_gen2_aviator" => Ok(Self::MarqGen2Aviator), + "d2_air_x10" => Ok(Self::D2AirX10), + "hrm_pro_plus" => Ok(Self::HrmProPlus), + "descent_g1_asia" => Ok(Self::DescentG1Asia), + "tactix7" => Ok(Self::Tactix7), + "instinct_crossover" => Ok(Self::InstinctCrossover), + "edge_explore2" => Ok(Self::EdgeExplore2), + "descent_mk3" => Ok(Self::DescentMk3), + "descent_mk3i" => Ok(Self::DescentMk3i), + "approach_s70" => Ok(Self::ApproachS70), + "fr265_large" => Ok(Self::Fr265Large), + "fr265_small" => Ok(Self::Fr265Small), + "venu3" => Ok(Self::Venu3), + "venu3s" => Ok(Self::Venu3s), + "tacx_neo_smart" => Ok(Self::TacxNeoSmart), + "tacx_neo2_smart" => Ok(Self::TacxNeo2Smart), + "tacx_neo2_t_smart" => Ok(Self::TacxNeo2TSmart), + "tacx_neo_smart_bike" => Ok(Self::TacxNeoSmartBike), + "tacx_satori_smart" => Ok(Self::TacxSatoriSmart), + "tacx_flow_smart" => Ok(Self::TacxFlowSmart), + "tacx_vortex_smart" => Ok(Self::TacxVortexSmart), + "tacx_bushido_smart" => Ok(Self::TacxBushidoSmart), + "tacx_genius_smart" => Ok(Self::TacxGeniusSmart), + "tacx_flux_flux_s_smart" => Ok(Self::TacxFluxFluxSSmart), + "tacx_flux2_smart" => Ok(Self::TacxFlux2Smart), + "tacx_magnum" => Ok(Self::TacxMagnum), + "edge_1040_asia" => Ok(Self::Edge1040Asia), + "epix_gen2_pro_42" => Ok(Self::EpixGen2Pro42), + "epix_gen2_pro_47" => Ok(Self::EpixGen2Pro47), + "epix_gen2_pro_51" => Ok(Self::EpixGen2Pro51), + "fr965" => Ok(Self::Fr965), + "enduro2" => Ok(Self::Enduro2), + "fenix7s_pro_solar" => Ok(Self::Fenix7sProSolar), + "fenix7_pro_solar" => Ok(Self::Fenix7ProSolar), + "fenix7x_pro_solar" => Ok(Self::Fenix7xProSolar), + "lily2" => Ok(Self::Lily2), + "instinct_2x" => Ok(Self::Instinct2x), + "vivoactive5" => Ok(Self::Vivoactive5), + "descent_t2" => Ok(Self::DescentT2), + "hrm_fit" => Ok(Self::HrmFit), + "marq_gen2_commander" => Ok(Self::MarqGen2Commander), + "d2_mach1_pro" => Ok(Self::D2Mach1Pro), + "sdm4" => Ok(Self::Sdm4), + "edge_remote" => Ok(Self::EdgeRemote), + "training_center" => Ok(Self::TrainingCenter), + "tacx_training_app_win" => Ok(Self::TacxTrainingAppWin), + "tacx_training_app_mac" => Ok(Self::TacxTrainingAppMac), + "tacx_training_app_mac_catalyst" => Ok(Self::TacxTrainingAppMacCatalyst), + "tacx_training_app_android" => Ok(Self::TacxTrainingAppAndroid), + "tacx_training_app_ios" => Ok(Self::TacxTrainingAppIos), + "tacx_training_app_legacy" => Ok(Self::TacxTrainingAppLegacy), + "connectiq_simulator" => Ok(Self::ConnectiqSimulator), + "android_antplus_plugin" => Ok(Self::AndroidAntplusPlugin), + "connect" => Ok(Self::Connect), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for GarminProduct { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum AntplusDeviceType { Antfs, @@ -10764,6 +13041,44 @@ impl Serialize for AntplusDeviceType { } } } +impl FromStr for AntplusDeviceType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "antfs" => Ok(Self::Antfs), + "bike_power" => Ok(Self::BikePower), + "environment_sensor_legacy" => Ok(Self::EnvironmentSensorLegacy), + "multi_sport_speed_distance" => Ok(Self::MultiSportSpeedDistance), + "control" => Ok(Self::Control), + "fitness_equipment" => Ok(Self::FitnessEquipment), + "blood_pressure" => Ok(Self::BloodPressure), + "geocache_node" => Ok(Self::GeocacheNode), + "light_electric_vehicle" => Ok(Self::LightElectricVehicle), + "env_sensor" => Ok(Self::EnvSensor), + "racquet" => Ok(Self::Racquet), + "control_hub" => Ok(Self::ControlHub), + "muscle_oxygen" => Ok(Self::MuscleOxygen), + "shifting" => Ok(Self::Shifting), + "bike_light_main" => Ok(Self::BikeLightMain), + "bike_light_shared" => Ok(Self::BikeLightShared), + "exd" => Ok(Self::Exd), + "bike_radar" => Ok(Self::BikeRadar), + "bike_aero" => Ok(Self::BikeAero), + "weight_scale" => Ok(Self::WeightScale), + "heart_rate" => Ok(Self::HeartRate), + "bike_speed_cadence" => Ok(Self::BikeSpeedCadence), + "bike_cadence" => Ok(Self::BikeCadence), + "bike_speed" => Ok(Self::BikeSpeed), + "stride_speed_distance" => Ok(Self::StrideSpeedDistance), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for AntplusDeviceType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum AntNetwork { Public, @@ -10830,6 +13145,23 @@ impl Serialize for AntNetwork { serializer.serialize_str(&self.to_string()) } } +impl FromStr for AntNetwork { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "public" => Ok(Self::Public), + "antplus" => Ok(Self::Antplus), + "antfs" => Ok(Self::Antfs), + "private" => Ok(Self::Private), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for AntNetwork { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WorkoutCapabilities { Interval, @@ -10957,6 +13289,33 @@ impl Serialize for WorkoutCapabilities { } } } +impl FromStr for WorkoutCapabilities { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "interval" => Ok(Self::Interval), + "custom" => Ok(Self::Custom), + "fitness_equipment" => Ok(Self::FitnessEquipment), + "firstbeat" => Ok(Self::Firstbeat), + "new_leaf" => Ok(Self::NewLeaf), + "tcx" => Ok(Self::Tcx), + "speed" => Ok(Self::Speed), + "heart_rate" => Ok(Self::HeartRate), + "distance" => Ok(Self::Distance), + "cadence" => Ok(Self::Cadence), + "power" => Ok(Self::Power), + "grade" => Ok(Self::Grade), + "resistance" => Ok(Self::Resistance), + "protected" => Ok(Self::Protected), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WorkoutCapabilities { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum BatteryStatus { New, @@ -11041,6 +13400,26 @@ impl Serialize for BatteryStatus { } } } +impl FromStr for BatteryStatus { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "new" => Ok(Self::New), + "good" => Ok(Self::Good), + "ok" => Ok(Self::Ok), + "low" => Ok(Self::Low), + "critical" => Ok(Self::Critical), + "charging" => Ok(Self::Charging), + "unknown" => Ok(Self::Unknown), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for BatteryStatus { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum HrType { Normal, @@ -11097,6 +13476,21 @@ impl Serialize for HrType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for HrType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "normal" => Ok(Self::Normal), + "irregular" => Ok(Self::Irregular), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for HrType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum CourseCapabilities { Processed, @@ -11207,6 +13601,31 @@ impl Serialize for CourseCapabilities { } } } +impl FromStr for CourseCapabilities { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "processed" => Ok(Self::Processed), + "valid" => Ok(Self::Valid), + "time" => Ok(Self::Time), + "distance" => Ok(Self::Distance), + "position" => Ok(Self::Position), + "heart_rate" => Ok(Self::HeartRate), + "power" => Ok(Self::Power), + "cadence" => Ok(Self::Cadence), + "training" => Ok(Self::Training), + "navigation" => Ok(Self::Navigation), + "bikeway" => Ok(Self::Bikeway), + "aviation" => Ok(Self::Aviation), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for CourseCapabilities { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Weight { Calculating, @@ -11261,6 +13680,20 @@ impl Serialize for Weight { } } } +impl FromStr for Weight { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "calculating" => Ok(Self::Calculating), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Weight { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// 0 - 100 indicates% of max hr; >100 indicates bpm (255 max) plus 100 #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WorkoutHr { @@ -11316,6 +13749,20 @@ impl Serialize for WorkoutHr { } } } +impl FromStr for WorkoutHr { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "bpm_offset" => Ok(Self::BpmOffset), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WorkoutHr { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// 0 - 1000 indicates % of functional threshold power; >1000 indicates watts plus 1000. #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WorkoutPower { @@ -11371,6 +13818,20 @@ impl Serialize for WorkoutPower { } } } +impl FromStr for WorkoutPower { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "watts_offset" => Ok(Self::WattsOffset), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WorkoutPower { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum BpStatus { NoError, @@ -11442,6 +13903,24 @@ impl Serialize for BpStatus { serializer.serialize_str(&self.to_string()) } } +impl FromStr for BpStatus { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "no_error" => Ok(Self::NoError), + "error_incomplete_data" => Ok(Self::ErrorIncompleteData), + "error_no_measurement" => Ok(Self::ErrorNoMeasurement), + "error_data_out_of_range" => Ok(Self::ErrorDataOutOfRange), + "error_irregular_heart_rate" => Ok(Self::ErrorIrregularHeartRate), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for BpStatus { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum UserLocalId { LocalMin, @@ -11521,6 +14000,25 @@ impl Serialize for UserLocalId { } } } +impl FromStr for UserLocalId { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "local_min" => Ok(Self::LocalMin), + "local_max" => Ok(Self::LocalMax), + "stationary_min" => Ok(Self::StationaryMin), + "stationary_max" => Ok(Self::StationaryMax), + "portable_min" => Ok(Self::PortableMin), + "portable_max" => Ok(Self::PortableMax), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for UserLocalId { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SwimStroke { Freestyle, @@ -11603,6 +14101,26 @@ impl Serialize for SwimStroke { serializer.serialize_str(&self.to_string()) } } +impl FromStr for SwimStroke { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "freestyle" => Ok(Self::Freestyle), + "backstroke" => Ok(Self::Backstroke), + "breaststroke" => Ok(Self::Breaststroke), + "butterfly" => Ok(Self::Butterfly), + "drill" => Ok(Self::Drill), + "mixed" => Ok(Self::Mixed), + "im" => Ok(Self::Im), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SwimStroke { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ActivityType { Generic, @@ -11696,6 +14214,28 @@ impl Serialize for ActivityType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for ActivityType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "generic" => Ok(Self::Generic), + "running" => Ok(Self::Running), + "cycling" => Ok(Self::Cycling), + "transition" => Ok(Self::Transition), + "fitness_equipment" => Ok(Self::FitnessEquipment), + "swimming" => Ok(Self::Swimming), + "walking" => Ok(Self::Walking), + "sedentary" => Ok(Self::Sedentary), + "all" => Ok(Self::All), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ActivityType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ActivitySubtype { Generic, @@ -11860,6 +14400,39 @@ impl Serialize for ActivitySubtype { serializer.serialize_str(&self.to_string()) } } +impl FromStr for ActivitySubtype { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "generic" => Ok(Self::Generic), + "treadmill" => Ok(Self::Treadmill), + "street" => Ok(Self::Street), + "trail" => Ok(Self::Trail), + "track" => Ok(Self::Track), + "spin" => Ok(Self::Spin), + "indoor_cycling" => Ok(Self::IndoorCycling), + "road" => Ok(Self::Road), + "mountain" => Ok(Self::Mountain), + "downhill" => Ok(Self::Downhill), + "recumbent" => Ok(Self::Recumbent), + "cyclocross" => Ok(Self::Cyclocross), + "hand_cycling" => Ok(Self::HandCycling), + "track_cycling" => Ok(Self::TrackCycling), + "indoor_rowing" => Ok(Self::IndoorRowing), + "elliptical" => Ok(Self::Elliptical), + "stair_climbing" => Ok(Self::StairClimbing), + "lap_swimming" => Ok(Self::LapSwimming), + "open_water" => Ok(Self::OpenWater), + "all" => Ok(Self::All), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ActivitySubtype { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ActivityLevel { Low, @@ -11921,6 +14494,22 @@ impl Serialize for ActivityLevel { serializer.serialize_str(&self.to_string()) } } +impl FromStr for ActivityLevel { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "low" => Ok(Self::Low), + "medium" => Ok(Self::Medium), + "high" => Ok(Self::High), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ActivityLevel { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Side { Right, @@ -11977,6 +14566,21 @@ impl Serialize for Side { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Side { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "right" => Ok(Self::Right), + "left" => Ok(Self::Left), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Side { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LeftRightBalance { /// % contribution @@ -12038,6 +14642,21 @@ impl Serialize for LeftRightBalance { } } } +impl FromStr for LeftRightBalance { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "mask" => Ok(Self::Mask), + "right" => Ok(Self::Right), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LeftRightBalance { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LeftRightBalance100 { /// % contribution scaled by 100 @@ -12099,6 +14718,21 @@ impl Serialize for LeftRightBalance100 { } } } +impl FromStr for LeftRightBalance100 { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "mask" => Ok(Self::Mask), + "right" => Ok(Self::Right), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LeftRightBalance100 { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LengthType { /// Rest period. Length with no strokes @@ -12157,6 +14791,21 @@ impl Serialize for LengthType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for LengthType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "idle" => Ok(Self::Idle), + "active" => Ok(Self::Active), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LengthType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DayOfWeek { Sunday, @@ -12238,6 +14887,26 @@ impl Serialize for DayOfWeek { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DayOfWeek { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "sunday" => Ok(Self::Sunday), + "monday" => Ok(Self::Monday), + "tuesday" => Ok(Self::Tuesday), + "wednesday" => Ok(Self::Wednesday), + "thursday" => Ok(Self::Thursday), + "friday" => Ok(Self::Friday), + "saturday" => Ok(Self::Saturday), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DayOfWeek { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ConnectivityCapabilities { Bluetooth, @@ -12468,6 +15137,51 @@ impl Serialize for ConnectivityCapabilities { } } } +impl FromStr for ConnectivityCapabilities { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "bluetooth" => Ok(Self::Bluetooth), + "bluetooth_le" => Ok(Self::BluetoothLe), + "ant" => Ok(Self::Ant), + "activity_upload" => Ok(Self::ActivityUpload), + "course_download" => Ok(Self::CourseDownload), + "workout_download" => Ok(Self::WorkoutDownload), + "live_track" => Ok(Self::LiveTrack), + "weather_conditions" => Ok(Self::WeatherConditions), + "weather_alerts" => Ok(Self::WeatherAlerts), + "gps_ephemeris_download" => Ok(Self::GpsEphemerisDownload), + "explicit_archive" => Ok(Self::ExplicitArchive), + "setup_incomplete" => Ok(Self::SetupIncomplete), + "continue_sync_after_software_update" => Ok(Self::ContinueSyncAfterSoftwareUpdate), + "connect_iq_app_download" => Ok(Self::ConnectIqAppDownload), + "golf_course_download" => Ok(Self::GolfCourseDownload), + "device_initiates_sync" => Ok(Self::DeviceInitiatesSync), + "connect_iq_watch_app_download" => Ok(Self::ConnectIqWatchAppDownload), + "connect_iq_widget_download" => Ok(Self::ConnectIqWidgetDownload), + "connect_iq_watch_face_download" => Ok(Self::ConnectIqWatchFaceDownload), + "connect_iq_data_field_download" => Ok(Self::ConnectIqDataFieldDownload), + "connect_iq_app_managment" => Ok(Self::ConnectIqAppManagment), + "swing_sensor" => Ok(Self::SwingSensor), + "swing_sensor_remote" => Ok(Self::SwingSensorRemote), + "incident_detection" => Ok(Self::IncidentDetection), + "audio_prompts" => Ok(Self::AudioPrompts), + "wifi_verification" => Ok(Self::WifiVerification), + "true_up" => Ok(Self::TrueUp), + "find_my_watch" => Ok(Self::FindMyWatch), + "remote_manual_sync" => Ok(Self::RemoteManualSync), + "live_track_auto_start" => Ok(Self::LiveTrackAutoStart), + "live_track_messaging" => Ok(Self::LiveTrackMessaging), + "instant_input" => Ok(Self::InstantInput), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ConnectivityCapabilities { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WeatherReport { Current, @@ -12529,6 +15243,22 @@ impl Serialize for WeatherReport { serializer.serialize_str(&self.to_string()) } } +impl FromStr for WeatherReport { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "current" => Ok(Self::Current), + "hourly_forecast" => Ok(Self::HourlyForecast), + "daily_forecast" => Ok(Self::DailyForecast), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WeatherReport { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WeatherStatus { Clear, @@ -12680,6 +15410,40 @@ impl Serialize for WeatherStatus { serializer.serialize_str(&self.to_string()) } } +impl FromStr for WeatherStatus { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "clear" => Ok(Self::Clear), + "partly_cloudy" => Ok(Self::PartlyCloudy), + "mostly_cloudy" => Ok(Self::MostlyCloudy), + "rain" => Ok(Self::Rain), + "snow" => Ok(Self::Snow), + "windy" => Ok(Self::Windy), + "thunderstorms" => Ok(Self::Thunderstorms), + "wintry_mix" => Ok(Self::WintryMix), + "fog" => Ok(Self::Fog), + "hazy" => Ok(Self::Hazy), + "hail" => Ok(Self::Hail), + "scattered_showers" => Ok(Self::ScatteredShowers), + "scattered_thunderstorms" => Ok(Self::ScatteredThunderstorms), + "unknown_precipitation" => Ok(Self::UnknownPrecipitation), + "light_rain" => Ok(Self::LightRain), + "heavy_rain" => Ok(Self::HeavyRain), + "light_snow" => Ok(Self::LightSnow), + "heavy_snow" => Ok(Self::HeavySnow), + "light_rain_snow" => Ok(Self::LightRainSnow), + "heavy_rain_snow" => Ok(Self::HeavyRainSnow), + "cloudy" => Ok(Self::Cloudy), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WeatherStatus { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WeatherSeverity { Unknown, @@ -12751,6 +15515,24 @@ impl Serialize for WeatherSeverity { serializer.serialize_str(&self.to_string()) } } +impl FromStr for WeatherSeverity { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "unknown" => Ok(Self::Unknown), + "warning" => Ok(Self::Warning), + "watch" => Ok(Self::Watch), + "advisory" => Ok(Self::Advisory), + "statement" => Ok(Self::Statement), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WeatherSeverity { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WeatherSevereType { Unspecified, @@ -13222,6 +16004,104 @@ impl Serialize for WeatherSevereType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for WeatherSevereType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "unspecified" => Ok(Self::Unspecified), + "tornado" => Ok(Self::Tornado), + "tsunami" => Ok(Self::Tsunami), + "hurricane" => Ok(Self::Hurricane), + "extreme_wind" => Ok(Self::ExtremeWind), + "typhoon" => Ok(Self::Typhoon), + "inland_hurricane" => Ok(Self::InlandHurricane), + "hurricane_force_wind" => Ok(Self::HurricaneForceWind), + "waterspout" => Ok(Self::Waterspout), + "severe_thunderstorm" => Ok(Self::SevereThunderstorm), + "wreckhouse_winds" => Ok(Self::WreckhouseWinds), + "les_suetes_wind" => Ok(Self::LesSuetesWind), + "avalanche" => Ok(Self::Avalanche), + "flash_flood" => Ok(Self::FlashFlood), + "tropical_storm" => Ok(Self::TropicalStorm), + "inland_tropical_storm" => Ok(Self::InlandTropicalStorm), + "blizzard" => Ok(Self::Blizzard), + "ice_storm" => Ok(Self::IceStorm), + "freezing_rain" => Ok(Self::FreezingRain), + "debris_flow" => Ok(Self::DebrisFlow), + "flash_freeze" => Ok(Self::FlashFreeze), + "dust_storm" => Ok(Self::DustStorm), + "high_wind" => Ok(Self::HighWind), + "winter_storm" => Ok(Self::WinterStorm), + "heavy_freezing_spray" => Ok(Self::HeavyFreezingSpray), + "extreme_cold" => Ok(Self::ExtremeCold), + "wind_chill" => Ok(Self::WindChill), + "cold_wave" => Ok(Self::ColdWave), + "heavy_snow_alert" => Ok(Self::HeavySnowAlert), + "lake_effect_blowing_snow" => Ok(Self::LakeEffectBlowingSnow), + "snow_squall" => Ok(Self::SnowSquall), + "lake_effect_snow" => Ok(Self::LakeEffectSnow), + "winter_weather" => Ok(Self::WinterWeather), + "sleet" => Ok(Self::Sleet), + "snowfall" => Ok(Self::Snowfall), + "snow_and_blowing_snow" => Ok(Self::SnowAndBlowingSnow), + "blowing_snow" => Ok(Self::BlowingSnow), + "snow_alert" => Ok(Self::SnowAlert), + "arctic_outflow" => Ok(Self::ArcticOutflow), + "freezing_drizzle" => Ok(Self::FreezingDrizzle), + "storm" => Ok(Self::Storm), + "storm_surge" => Ok(Self::StormSurge), + "rainfall" => Ok(Self::Rainfall), + "areal_flood" => Ok(Self::ArealFlood), + "coastal_flood" => Ok(Self::CoastalFlood), + "lakeshore_flood" => Ok(Self::LakeshoreFlood), + "excessive_heat" => Ok(Self::ExcessiveHeat), + "heat" => Ok(Self::Heat), + "weather" => Ok(Self::Weather), + "high_heat_and_humidity" => Ok(Self::HighHeatAndHumidity), + "humidex_and_health" => Ok(Self::HumidexAndHealth), + "humidex" => Ok(Self::Humidex), + "gale" => Ok(Self::Gale), + "freezing_spray" => Ok(Self::FreezingSpray), + "special_marine" => Ok(Self::SpecialMarine), + "squall" => Ok(Self::Squall), + "strong_wind" => Ok(Self::StrongWind), + "lake_wind" => Ok(Self::LakeWind), + "marine_weather" => Ok(Self::MarineWeather), + "wind" => Ok(Self::Wind), + "small_craft_hazardous_seas" => Ok(Self::SmallCraftHazardousSeas), + "hazardous_seas" => Ok(Self::HazardousSeas), + "small_craft" => Ok(Self::SmallCraft), + "small_craft_winds" => Ok(Self::SmallCraftWinds), + "small_craft_rough_bar" => Ok(Self::SmallCraftRoughBar), + "high_water_level" => Ok(Self::HighWaterLevel), + "ashfall" => Ok(Self::Ashfall), + "freezing_fog" => Ok(Self::FreezingFog), + "dense_fog" => Ok(Self::DenseFog), + "dense_smoke" => Ok(Self::DenseSmoke), + "blowing_dust" => Ok(Self::BlowingDust), + "hard_freeze" => Ok(Self::HardFreeze), + "freeze" => Ok(Self::Freeze), + "frost" => Ok(Self::Frost), + "fire_weather" => Ok(Self::FireWeather), + "flood" => Ok(Self::Flood), + "rip_tide" => Ok(Self::RipTide), + "high_surf" => Ok(Self::HighSurf), + "smog" => Ok(Self::Smog), + "air_quality" => Ok(Self::AirQuality), + "brisk_wind" => Ok(Self::BriskWind), + "air_stagnation" => Ok(Self::AirStagnation), + "low_water" => Ok(Self::LowWater), + "hydrological" => Ok(Self::Hydrological), + "special_weather" => Ok(Self::SpecialWeather), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WeatherSevereType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum StrokeType { NoEvent, @@ -13299,6 +16179,25 @@ impl Serialize for StrokeType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for StrokeType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "no_event" => Ok(Self::NoEvent), + "other" => Ok(Self::Other), + "serve" => Ok(Self::Serve), + "forehand" => Ok(Self::Forehand), + "backhand" => Ok(Self::Backhand), + "smash" => Ok(Self::Smash), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for StrokeType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum BodyLocation { LeftLeg, @@ -13549,6 +16448,59 @@ impl Serialize for BodyLocation { serializer.serialize_str(&self.to_string()) } } +impl FromStr for BodyLocation { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "left_leg" => Ok(Self::LeftLeg), + "left_calf" => Ok(Self::LeftCalf), + "left_shin" => Ok(Self::LeftShin), + "left_hamstring" => Ok(Self::LeftHamstring), + "left_quad" => Ok(Self::LeftQuad), + "left_glute" => Ok(Self::LeftGlute), + "right_leg" => Ok(Self::RightLeg), + "right_calf" => Ok(Self::RightCalf), + "right_shin" => Ok(Self::RightShin), + "right_hamstring" => Ok(Self::RightHamstring), + "right_quad" => Ok(Self::RightQuad), + "right_glute" => Ok(Self::RightGlute), + "torso_back" => Ok(Self::TorsoBack), + "left_lower_back" => Ok(Self::LeftLowerBack), + "left_upper_back" => Ok(Self::LeftUpperBack), + "right_lower_back" => Ok(Self::RightLowerBack), + "right_upper_back" => Ok(Self::RightUpperBack), + "torso_front" => Ok(Self::TorsoFront), + "left_abdomen" => Ok(Self::LeftAbdomen), + "left_chest" => Ok(Self::LeftChest), + "right_abdomen" => Ok(Self::RightAbdomen), + "right_chest" => Ok(Self::RightChest), + "left_arm" => Ok(Self::LeftArm), + "left_shoulder" => Ok(Self::LeftShoulder), + "left_bicep" => Ok(Self::LeftBicep), + "left_tricep" => Ok(Self::LeftTricep), + "left_brachioradialis" => Ok(Self::LeftBrachioradialis), + "left_forearm_extensors" => Ok(Self::LeftForearmExtensors), + "right_arm" => Ok(Self::RightArm), + "right_shoulder" => Ok(Self::RightShoulder), + "right_bicep" => Ok(Self::RightBicep), + "right_tricep" => Ok(Self::RightTricep), + "right_brachioradialis" => Ok(Self::RightBrachioradialis), + "right_forearm_extensors" => Ok(Self::RightForearmExtensors), + "neck" => Ok(Self::Neck), + "throat" => Ok(Self::Throat), + "waist_mid_back" => Ok(Self::WaistMidBack), + "waist_front" => Ok(Self::WaistFront), + "waist_left" => Ok(Self::WaistLeft), + "waist_right" => Ok(Self::WaistRight), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for BodyLocation { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SegmentLapStatus { End, @@ -13605,6 +16557,21 @@ impl Serialize for SegmentLapStatus { serializer.serialize_str(&self.to_string()) } } +impl FromStr for SegmentLapStatus { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "end" => Ok(Self::End), + "fail" => Ok(Self::Fail), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SegmentLapStatus { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SegmentLeaderboardType { Overall, @@ -13708,6 +16675,30 @@ impl Serialize for SegmentLeaderboardType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for SegmentLeaderboardType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "overall" => Ok(Self::Overall), + "personal_best" => Ok(Self::PersonalBest), + "connections" => Ok(Self::Connections), + "group" => Ok(Self::Group), + "challenger" => Ok(Self::Challenger), + "kom" => Ok(Self::Kom), + "qom" => Ok(Self::Qom), + "pr" => Ok(Self::Pr), + "goal" => Ok(Self::Goal), + "rival" => Ok(Self::Rival), + "club_leader" => Ok(Self::ClubLeader), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SegmentLeaderboardType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SegmentDeleteStatus { DoNotDelete, @@ -13769,6 +16760,22 @@ impl Serialize for SegmentDeleteStatus { serializer.serialize_str(&self.to_string()) } } +impl FromStr for SegmentDeleteStatus { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "do_not_delete" => Ok(Self::DoNotDelete), + "delete_one" => Ok(Self::DeleteOne), + "delete_all" => Ok(Self::DeleteAll), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SegmentDeleteStatus { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SegmentSelectionType { Starred, @@ -13825,6 +16832,21 @@ impl Serialize for SegmentSelectionType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for SegmentSelectionType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "starred" => Ok(Self::Starred), + "suggested" => Ok(Self::Suggested), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SegmentSelectionType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SourceType { /// External device connected with ANT @@ -13907,6 +16929,25 @@ impl Serialize for SourceType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for SourceType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "ant" => Ok(Self::Ant), + "antplus" => Ok(Self::Antplus), + "bluetooth" => Ok(Self::Bluetooth), + "bluetooth_low_energy" => Ok(Self::BluetoothLowEnergy), + "wifi" => Ok(Self::Wifi), + "local" => Ok(Self::Local), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SourceType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LocalDeviceType { /// Onboard gps receiver @@ -14004,6 +17045,27 @@ impl Serialize for LocalDeviceType { } } } +impl FromStr for LocalDeviceType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "gps" => Ok(Self::Gps), + "glonass" => Ok(Self::Glonass), + "gps_glonass" => Ok(Self::GpsGlonass), + "accelerometer" => Ok(Self::Accelerometer), + "barometer" => Ok(Self::Barometer), + "temperature" => Ok(Self::Temperature), + "whr" => Ok(Self::Whr), + "sensor_hub" => Ok(Self::SensorHub), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LocalDeviceType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum BleDeviceType { /// GPS that is provided over a proprietary bluetooth service @@ -14095,6 +17157,27 @@ impl Serialize for BleDeviceType { } } } +impl FromStr for BleDeviceType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "connected_gps" => Ok(Self::ConnectedGps), + "heart_rate" => Ok(Self::HeartRate), + "bike_power" => Ok(Self::BikePower), + "bike_speed_cadence" => Ok(Self::BikeSpeedCadence), + "bike_speed" => Ok(Self::BikeSpeed), + "bike_cadence" => Ok(Self::BikeCadence), + "footpod" => Ok(Self::Footpod), + "bike_trainer" => Ok(Self::BikeTrainer), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for BleDeviceType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum AntChannelId { AntDeviceNumber, @@ -14168,6 +17251,25 @@ impl Serialize for AntChannelId { } } } +impl FromStr for AntChannelId { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "ant_device_number" => Ok(Self::AntDeviceNumber), + "ant_device_type" => Ok(Self::AntDeviceType), + "ant_transmission_type_lower_nibble" => Ok(Self::AntTransmissionTypeLowerNibble), + "ant_extended_device_number_upper_nibble" => { + Ok(Self::AntExtendedDeviceNumberUpperNibble) + } + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for AntChannelId { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DisplayOrientation { /// automatic if the device supports it @@ -14242,6 +17344,24 @@ impl Serialize for DisplayOrientation { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DisplayOrientation { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "auto" => Ok(Self::Auto), + "portrait" => Ok(Self::Portrait), + "landscape" => Ok(Self::Landscape), + "portrait_flipped" => Ok(Self::PortraitFlipped), + "landscape_flipped" => Ok(Self::LandscapeFlipped), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DisplayOrientation { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WorkoutEquipment { None, @@ -14318,6 +17438,25 @@ impl Serialize for WorkoutEquipment { serializer.serialize_str(&self.to_string()) } } +impl FromStr for WorkoutEquipment { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "none" => Ok(Self::None), + "swim_fins" => Ok(Self::SwimFins), + "swim_kickboard" => Ok(Self::SwimKickboard), + "swim_paddles" => Ok(Self::SwimPaddles), + "swim_pull_buoy" => Ok(Self::SwimPullBuoy), + "swim_snorkel" => Ok(Self::SwimSnorkel), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WorkoutEquipment { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WatchfaceMode { Digital, @@ -14384,6 +17523,23 @@ impl Serialize for WatchfaceMode { serializer.serialize_str(&self.to_string()) } } +impl FromStr for WatchfaceMode { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "digital" => Ok(Self::Digital), + "analog" => Ok(Self::Analog), + "connect_iq" => Ok(Self::ConnectIq), + "disabled" => Ok(Self::Disabled), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WatchfaceMode { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DigitalWatchfaceLayout { Traditional, @@ -14447,6 +17603,22 @@ impl Serialize for DigitalWatchfaceLayout { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DigitalWatchfaceLayout { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "traditional" => Ok(Self::Traditional), + "modern" => Ok(Self::Modern), + "bold" => Ok(Self::Bold), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DigitalWatchfaceLayout { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum AnalogWatchfaceLayout { Minimal, @@ -14508,6 +17680,22 @@ impl Serialize for AnalogWatchfaceLayout { serializer.serialize_str(&self.to_string()) } } +impl FromStr for AnalogWatchfaceLayout { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "minimal" => Ok(Self::Minimal), + "traditional" => Ok(Self::Traditional), + "modern" => Ok(Self::Modern), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for AnalogWatchfaceLayout { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum RiderPositionType { Seated, @@ -14574,6 +17762,23 @@ impl Serialize for RiderPositionType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for RiderPositionType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "seated" => Ok(Self::Seated), + "standing" => Ok(Self::Standing), + "transition_to_seated" => Ok(Self::TransitionToSeated), + "transition_to_standing" => Ok(Self::TransitionToStanding), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for RiderPositionType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum PowerPhaseType { PowerPhaseStartAngle, @@ -14640,6 +17845,23 @@ impl Serialize for PowerPhaseType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for PowerPhaseType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "power_phase_start_angle" => Ok(Self::PowerPhaseStartAngle), + "power_phase_end_angle" => Ok(Self::PowerPhaseEndAngle), + "power_phase_arc_length" => Ok(Self::PowerPhaseArcLength), + "power_phase_center" => Ok(Self::PowerPhaseCenter), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for PowerPhaseType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum CameraEventType { /// Start of video recording @@ -14760,6 +17982,32 @@ impl Serialize for CameraEventType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for CameraEventType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "video_start" => Ok(Self::VideoStart), + "video_split" => Ok(Self::VideoSplit), + "video_end" => Ok(Self::VideoEnd), + "photo_taken" => Ok(Self::PhotoTaken), + "video_second_stream_start" => Ok(Self::VideoSecondStreamStart), + "video_second_stream_split" => Ok(Self::VideoSecondStreamSplit), + "video_second_stream_end" => Ok(Self::VideoSecondStreamEnd), + "video_split_start" => Ok(Self::VideoSplitStart), + "video_second_stream_split_start" => Ok(Self::VideoSecondStreamSplitStart), + "video_pause" => Ok(Self::VideoPause), + "video_second_stream_pause" => Ok(Self::VideoSecondStreamPause), + "video_resume" => Ok(Self::VideoResume), + "video_second_stream_resume" => Ok(Self::VideoSecondStreamResume), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for CameraEventType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SensorType { Accelerometer, @@ -14827,6 +18075,23 @@ impl Serialize for SensorType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for SensorType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "accelerometer" => Ok(Self::Accelerometer), + "gyroscope" => Ok(Self::Gyroscope), + "compass" => Ok(Self::Compass), + "barometer" => Ok(Self::Barometer), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SensorType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum BikeLightNetworkConfigType { Auto, @@ -14895,6 +18160,23 @@ impl Serialize for BikeLightNetworkConfigType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for BikeLightNetworkConfigType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "auto" => Ok(Self::Auto), + "individual" => Ok(Self::Individual), + "high_visibility" => Ok(Self::HighVisibility), + "trail" => Ok(Self::Trail), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for BikeLightNetworkConfigType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum CommTimeoutType { /// Timeout pairing to any device @@ -14968,6 +18250,23 @@ impl Serialize for CommTimeoutType { } } } +impl FromStr for CommTimeoutType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "wildcard_pairing_timeout" => Ok(Self::WildcardPairingTimeout), + "pairing_timeout" => Ok(Self::PairingTimeout), + "connection_lost" => Ok(Self::ConnectionLost), + "connection_timeout" => Ok(Self::ConnectionTimeout), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for CommTimeoutType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum CameraOrientationType { CameraOrientation0, @@ -15034,6 +18333,23 @@ impl Serialize for CameraOrientationType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for CameraOrientationType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "camera_orientation_0" => Ok(Self::CameraOrientation0), + "camera_orientation_90" => Ok(Self::CameraOrientation90), + "camera_orientation_180" => Ok(Self::CameraOrientation180), + "camera_orientation_270" => Ok(Self::CameraOrientation270), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for CameraOrientationType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum AttitudeStage { Failed, @@ -15100,6 +18416,23 @@ impl Serialize for AttitudeStage { serializer.serialize_str(&self.to_string()) } } +impl FromStr for AttitudeStage { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "failed" => Ok(Self::Failed), + "aligning" => Ok(Self::Aligning), + "degraded" => Ok(Self::Degraded), + "valid" => Ok(Self::Valid), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for AttitudeStage { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum AttitudeValidity { TrackAngleHeadingValid, @@ -15214,6 +18547,32 @@ impl Serialize for AttitudeValidity { } } } +impl FromStr for AttitudeValidity { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "track_angle_heading_valid" => Ok(Self::TrackAngleHeadingValid), + "pitch_valid" => Ok(Self::PitchValid), + "roll_valid" => Ok(Self::RollValid), + "lateral_body_accel_valid" => Ok(Self::LateralBodyAccelValid), + "normal_body_accel_valid" => Ok(Self::NormalBodyAccelValid), + "turn_rate_valid" => Ok(Self::TurnRateValid), + "hw_fail" => Ok(Self::HwFail), + "mag_invalid" => Ok(Self::MagInvalid), + "no_gps" => Ok(Self::NoGps), + "gps_invalid" => Ok(Self::GpsInvalid), + "solution_coasting" => Ok(Self::SolutionCoasting), + "true_track_angle" => Ok(Self::TrueTrackAngle), + "magnetic_heading" => Ok(Self::MagneticHeading), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for AttitudeValidity { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum AutoSyncFrequency { Never, @@ -15285,6 +18644,24 @@ impl Serialize for AutoSyncFrequency { serializer.serialize_str(&self.to_string()) } } +impl FromStr for AutoSyncFrequency { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "never" => Ok(Self::Never), + "occasionally" => Ok(Self::Occasionally), + "frequent" => Ok(Self::Frequent), + "once_a_day" => Ok(Self::OnceADay), + "remote" => Ok(Self::Remote), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for AutoSyncFrequency { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ExdLayout { FullScreen, @@ -15377,6 +18754,28 @@ impl Serialize for ExdLayout { serializer.serialize_str(&self.to_string()) } } +impl FromStr for ExdLayout { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "full_screen" => Ok(Self::FullScreen), + "half_vertical" => Ok(Self::HalfVertical), + "half_horizontal" => Ok(Self::HalfHorizontal), + "half_vertical_right_split" => Ok(Self::HalfVerticalRightSplit), + "half_horizontal_bottom_split" => Ok(Self::HalfHorizontalBottomSplit), + "full_quarter_split" => Ok(Self::FullQuarterSplit), + "half_vertical_left_split" => Ok(Self::HalfVerticalLeftSplit), + "half_horizontal_top_split" => Ok(Self::HalfHorizontalTopSplit), + "dynamic" => Ok(Self::Dynamic), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ExdLayout { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ExdDisplayType { Numerical, @@ -15478,6 +18877,30 @@ impl Serialize for ExdDisplayType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for ExdDisplayType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "numerical" => Ok(Self::Numerical), + "simple" => Ok(Self::Simple), + "graph" => Ok(Self::Graph), + "bar" => Ok(Self::Bar), + "circle_graph" => Ok(Self::CircleGraph), + "virtual_partner" => Ok(Self::VirtualPartner), + "balance" => Ok(Self::Balance), + "string_list" => Ok(Self::StringList), + "string" => Ok(Self::String), + "simple_dynamic_icon" => Ok(Self::SimpleDynamicIcon), + "gauge" => Ok(Self::Gauge), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ExdDisplayType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ExdDataUnits { NoUnits, @@ -15778,6 +19201,69 @@ impl Serialize for ExdDataUnits { serializer.serialize_str(&self.to_string()) } } +impl FromStr for ExdDataUnits { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "no_units" => Ok(Self::NoUnits), + "laps" => Ok(Self::Laps), + "miles_per_hour" => Ok(Self::MilesPerHour), + "kilometers_per_hour" => Ok(Self::KilometersPerHour), + "feet_per_hour" => Ok(Self::FeetPerHour), + "meters_per_hour" => Ok(Self::MetersPerHour), + "degrees_celsius" => Ok(Self::DegreesCelsius), + "degrees_farenheit" => Ok(Self::DegreesFarenheit), + "zone" => Ok(Self::Zone), + "gear" => Ok(Self::Gear), + "rpm" => Ok(Self::Rpm), + "bpm" => Ok(Self::Bpm), + "degrees" => Ok(Self::Degrees), + "millimeters" => Ok(Self::Millimeters), + "meters" => Ok(Self::Meters), + "kilometers" => Ok(Self::Kilometers), + "feet" => Ok(Self::Feet), + "yards" => Ok(Self::Yards), + "kilofeet" => Ok(Self::Kilofeet), + "miles" => Ok(Self::Miles), + "time" => Ok(Self::Time), + "enum_turn_type" => Ok(Self::EnumTurnType), + "percent" => Ok(Self::Percent), + "watts" => Ok(Self::Watts), + "watts_per_kilogram" => Ok(Self::WattsPerKilogram), + "enum_battery_status" => Ok(Self::EnumBatteryStatus), + "enum_bike_light_beam_angle_mode" => Ok(Self::EnumBikeLightBeamAngleMode), + "enum_bike_light_battery_status" => Ok(Self::EnumBikeLightBatteryStatus), + "enum_bike_light_network_config_type" => Ok(Self::EnumBikeLightNetworkConfigType), + "lights" => Ok(Self::Lights), + "seconds" => Ok(Self::Seconds), + "minutes" => Ok(Self::Minutes), + "hours" => Ok(Self::Hours), + "calories" => Ok(Self::Calories), + "kilojoules" => Ok(Self::Kilojoules), + "milliseconds" => Ok(Self::Milliseconds), + "second_per_mile" => Ok(Self::SecondPerMile), + "second_per_kilometer" => Ok(Self::SecondPerKilometer), + "centimeter" => Ok(Self::Centimeter), + "enum_course_point" => Ok(Self::EnumCoursePoint), + "bradians" => Ok(Self::Bradians), + "enum_sport" => Ok(Self::EnumSport), + "inches_hg" => Ok(Self::InchesHg), + "mm_hg" => Ok(Self::MmHg), + "mbars" => Ok(Self::Mbars), + "hecto_pascals" => Ok(Self::HectoPascals), + "feet_per_min" => Ok(Self::FeetPerMin), + "meters_per_min" => Ok(Self::MetersPerMin), + "meters_per_sec" => Ok(Self::MetersPerSec), + "eight_cardinal" => Ok(Self::EightCardinal), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ExdDataUnits { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ExdQualifiers { NoQualifier, @@ -16044,6 +19530,63 @@ impl Serialize for ExdQualifiers { serializer.serialize_str(&self.to_string()) } } +impl FromStr for ExdQualifiers { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "no_qualifier" => Ok(Self::NoQualifier), + "instantaneous" => Ok(Self::Instantaneous), + "average" => Ok(Self::Average), + "lap" => Ok(Self::Lap), + "maximum" => Ok(Self::Maximum), + "maximum_average" => Ok(Self::MaximumAverage), + "maximum_lap" => Ok(Self::MaximumLap), + "last_lap" => Ok(Self::LastLap), + "average_lap" => Ok(Self::AverageLap), + "to_destination" => Ok(Self::ToDestination), + "to_go" => Ok(Self::ToGo), + "to_next" => Ok(Self::ToNext), + "next_course_point" => Ok(Self::NextCoursePoint), + "total" => Ok(Self::Total), + "three_second_average" => Ok(Self::ThreeSecondAverage), + "ten_second_average" => Ok(Self::TenSecondAverage), + "thirty_second_average" => Ok(Self::ThirtySecondAverage), + "percent_maximum" => Ok(Self::PercentMaximum), + "percent_maximum_average" => Ok(Self::PercentMaximumAverage), + "lap_percent_maximum" => Ok(Self::LapPercentMaximum), + "elapsed" => Ok(Self::Elapsed), + "sunrise" => Ok(Self::Sunrise), + "sunset" => Ok(Self::Sunset), + "compared_to_virtual_partner" => Ok(Self::ComparedToVirtualPartner), + "maximum_24h" => Ok(Self::Maximum24h), + "minimum_24h" => Ok(Self::Minimum24h), + "minimum" => Ok(Self::Minimum), + "first" => Ok(Self::First), + "second" => Ok(Self::Second), + "third" => Ok(Self::Third), + "shifter" => Ok(Self::Shifter), + "last_sport" => Ok(Self::LastSport), + "moving" => Ok(Self::Moving), + "stopped" => Ok(Self::Stopped), + "estimated_total" => Ok(Self::EstimatedTotal), + "zone_9" => Ok(Self::Zone9), + "zone_8" => Ok(Self::Zone8), + "zone_7" => Ok(Self::Zone7), + "zone_6" => Ok(Self::Zone6), + "zone_5" => Ok(Self::Zone5), + "zone_4" => Ok(Self::Zone4), + "zone_3" => Ok(Self::Zone3), + "zone_2" => Ok(Self::Zone2), + "zone_1" => Ok(Self::Zone1), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ExdQualifiers { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ExdDescriptors { BikeLightBatteryStatus, @@ -16586,6 +20129,116 @@ impl Serialize for ExdDescriptors { serializer.serialize_str(&self.to_string()) } } +impl FromStr for ExdDescriptors { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "bike_light_battery_status" => Ok(Self::BikeLightBatteryStatus), + "beam_angle_status" => Ok(Self::BeamAngleStatus), + "batery_level" => Ok(Self::BateryLevel), + "light_network_mode" => Ok(Self::LightNetworkMode), + "number_lights_connected" => Ok(Self::NumberLightsConnected), + "cadence" => Ok(Self::Cadence), + "distance" => Ok(Self::Distance), + "estimated_time_of_arrival" => Ok(Self::EstimatedTimeOfArrival), + "heading" => Ok(Self::Heading), + "time" => Ok(Self::Time), + "battery_level" => Ok(Self::BatteryLevel), + "trainer_resistance" => Ok(Self::TrainerResistance), + "trainer_target_power" => Ok(Self::TrainerTargetPower), + "time_seated" => Ok(Self::TimeSeated), + "time_standing" => Ok(Self::TimeStanding), + "elevation" => Ok(Self::Elevation), + "grade" => Ok(Self::Grade), + "ascent" => Ok(Self::Ascent), + "descent" => Ok(Self::Descent), + "vertical_speed" => Ok(Self::VerticalSpeed), + "di2_battery_level" => Ok(Self::Di2BatteryLevel), + "front_gear" => Ok(Self::FrontGear), + "rear_gear" => Ok(Self::RearGear), + "gear_ratio" => Ok(Self::GearRatio), + "heart_rate" => Ok(Self::HeartRate), + "heart_rate_zone" => Ok(Self::HeartRateZone), + "time_in_heart_rate_zone" => Ok(Self::TimeInHeartRateZone), + "heart_rate_reserve" => Ok(Self::HeartRateReserve), + "calories" => Ok(Self::Calories), + "gps_accuracy" => Ok(Self::GpsAccuracy), + "gps_signal_strength" => Ok(Self::GpsSignalStrength), + "temperature" => Ok(Self::Temperature), + "time_of_day" => Ok(Self::TimeOfDay), + "balance" => Ok(Self::Balance), + "pedal_smoothness" => Ok(Self::PedalSmoothness), + "power" => Ok(Self::Power), + "functional_threshold_power" => Ok(Self::FunctionalThresholdPower), + "intensity_factor" => Ok(Self::IntensityFactor), + "work" => Ok(Self::Work), + "power_ratio" => Ok(Self::PowerRatio), + "normalized_power" => Ok(Self::NormalizedPower), + "training_stress_Score" => Ok(Self::TrainingStressScore), + "time_on_zone" => Ok(Self::TimeOnZone), + "speed" => Ok(Self::Speed), + "laps" => Ok(Self::Laps), + "reps" => Ok(Self::Reps), + "workout_step" => Ok(Self::WorkoutStep), + "course_distance" => Ok(Self::CourseDistance), + "navigation_distance" => Ok(Self::NavigationDistance), + "course_estimated_time_of_arrival" => Ok(Self::CourseEstimatedTimeOfArrival), + "navigation_estimated_time_of_arrival" => Ok(Self::NavigationEstimatedTimeOfArrival), + "course_time" => Ok(Self::CourseTime), + "navigation_time" => Ok(Self::NavigationTime), + "course_heading" => Ok(Self::CourseHeading), + "navigation_heading" => Ok(Self::NavigationHeading), + "power_zone" => Ok(Self::PowerZone), + "torque_effectiveness" => Ok(Self::TorqueEffectiveness), + "timer_time" => Ok(Self::TimerTime), + "power_weight_ratio" => Ok(Self::PowerWeightRatio), + "left_platform_center_offset" => Ok(Self::LeftPlatformCenterOffset), + "right_platform_center_offset" => Ok(Self::RightPlatformCenterOffset), + "left_power_phase_start_angle" => Ok(Self::LeftPowerPhaseStartAngle), + "right_power_phase_start_angle" => Ok(Self::RightPowerPhaseStartAngle), + "left_power_phase_finish_angle" => Ok(Self::LeftPowerPhaseFinishAngle), + "right_power_phase_finish_angle" => Ok(Self::RightPowerPhaseFinishAngle), + "gears" => Ok(Self::Gears), + "pace" => Ok(Self::Pace), + "training_effect" => Ok(Self::TrainingEffect), + "vertical_oscillation" => Ok(Self::VerticalOscillation), + "vertical_ratio" => Ok(Self::VerticalRatio), + "ground_contact_time" => Ok(Self::GroundContactTime), + "left_ground_contact_time_balance" => Ok(Self::LeftGroundContactTimeBalance), + "right_ground_contact_time_balance" => Ok(Self::RightGroundContactTimeBalance), + "stride_length" => Ok(Self::StrideLength), + "running_cadence" => Ok(Self::RunningCadence), + "performance_condition" => Ok(Self::PerformanceCondition), + "course_type" => Ok(Self::CourseType), + "time_in_power_zone" => Ok(Self::TimeInPowerZone), + "navigation_turn" => Ok(Self::NavigationTurn), + "course_location" => Ok(Self::CourseLocation), + "navigation_location" => Ok(Self::NavigationLocation), + "compass" => Ok(Self::Compass), + "gear_combo" => Ok(Self::GearCombo), + "muscle_oxygen" => Ok(Self::MuscleOxygen), + "icon" => Ok(Self::Icon), + "compass_heading" => Ok(Self::CompassHeading), + "gps_heading" => Ok(Self::GpsHeading), + "gps_elevation" => Ok(Self::GpsElevation), + "anaerobic_training_effect" => Ok(Self::AnaerobicTrainingEffect), + "course" => Ok(Self::Course), + "off_course" => Ok(Self::OffCourse), + "glide_ratio" => Ok(Self::GlideRatio), + "vertical_distance" => Ok(Self::VerticalDistance), + "vmg" => Ok(Self::Vmg), + "ambient_pressure" => Ok(Self::AmbientPressure), + "pressure" => Ok(Self::Pressure), + "vam" => Ok(Self::Vam), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ExdDescriptors { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum AutoActivityDetect { None, @@ -16670,6 +20323,26 @@ impl Serialize for AutoActivityDetect { } } } +impl FromStr for AutoActivityDetect { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "none" => Ok(Self::None), + "running" => Ok(Self::Running), + "cycling" => Ok(Self::Cycling), + "swimming" => Ok(Self::Swimming), + "walking" => Ok(Self::Walking), + "elliptical" => Ok(Self::Elliptical), + "sedentary" => Ok(Self::Sedentary), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for AutoActivityDetect { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SupportedExdScreenLayouts { FullScreen, @@ -16767,6 +20440,27 @@ impl Serialize for SupportedExdScreenLayouts { } } } +impl FromStr for SupportedExdScreenLayouts { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "full_screen" => Ok(Self::FullScreen), + "half_vertical" => Ok(Self::HalfVertical), + "half_horizontal" => Ok(Self::HalfHorizontal), + "half_vertical_right_split" => Ok(Self::HalfVerticalRightSplit), + "half_horizontal_bottom_split" => Ok(Self::HalfHorizontalBottomSplit), + "full_quarter_split" => Ok(Self::FullQuarterSplit), + "half_vertical_left_split" => Ok(Self::HalfVerticalLeftSplit), + "half_horizontal_top_split" => Ok(Self::HalfHorizontalTopSplit), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SupportedExdScreenLayouts { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum FitBaseType { Enum, @@ -16901,6 +20595,36 @@ impl Serialize for FitBaseType { } } } +impl FromStr for FitBaseType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "enum" => Ok(Self::Enum), + "sint8" => Ok(Self::Sint8), + "uint8" => Ok(Self::Uint8), + "string" => Ok(Self::String), + "uint8z" => Ok(Self::Uint8z), + "byte" => Ok(Self::Byte), + "sint16" => Ok(Self::Sint16), + "uint16" => Ok(Self::Uint16), + "sint32" => Ok(Self::Sint32), + "uint32" => Ok(Self::Uint32), + "float32" => Ok(Self::Float32), + "float64" => Ok(Self::Float64), + "uint16z" => Ok(Self::Uint16z), + "uint32z" => Ok(Self::Uint32z), + "sint64" => Ok(Self::Sint64), + "uint64" => Ok(Self::Uint64), + "uint64z" => Ok(Self::Uint64z), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for FitBaseType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum TurnType { ArrivingIdx, @@ -17137,6 +20861,57 @@ impl Serialize for TurnType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for TurnType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "arriving_idx" => Ok(Self::ArrivingIdx), + "arriving_left_idx" => Ok(Self::ArrivingLeftIdx), + "arriving_right_idx" => Ok(Self::ArrivingRightIdx), + "arriving_via_idx" => Ok(Self::ArrivingViaIdx), + "arriving_via_left_idx" => Ok(Self::ArrivingViaLeftIdx), + "arriving_via_right_idx" => Ok(Self::ArrivingViaRightIdx), + "bear_keep_left_idx" => Ok(Self::BearKeepLeftIdx), + "bear_keep_right_idx" => Ok(Self::BearKeepRightIdx), + "continue_idx" => Ok(Self::ContinueIdx), + "exit_left_idx" => Ok(Self::ExitLeftIdx), + "exit_right_idx" => Ok(Self::ExitRightIdx), + "ferry_idx" => Ok(Self::FerryIdx), + "roundabout_45_idx" => Ok(Self::Roundabout45Idx), + "roundabout_90_idx" => Ok(Self::Roundabout90Idx), + "roundabout_135_idx" => Ok(Self::Roundabout135Idx), + "roundabout_180_idx" => Ok(Self::Roundabout180Idx), + "roundabout_225_idx" => Ok(Self::Roundabout225Idx), + "roundabout_270_idx" => Ok(Self::Roundabout270Idx), + "roundabout_315_idx" => Ok(Self::Roundabout315Idx), + "roundabout_360_idx" => Ok(Self::Roundabout360Idx), + "roundabout_neg_45_idx" => Ok(Self::RoundaboutNeg45Idx), + "roundabout_neg_90_idx" => Ok(Self::RoundaboutNeg90Idx), + "roundabout_neg_135_idx" => Ok(Self::RoundaboutNeg135Idx), + "roundabout_neg_180_idx" => Ok(Self::RoundaboutNeg180Idx), + "roundabout_neg_225_idx" => Ok(Self::RoundaboutNeg225Idx), + "roundabout_neg_270_idx" => Ok(Self::RoundaboutNeg270Idx), + "roundabout_neg_315_idx" => Ok(Self::RoundaboutNeg315Idx), + "roundabout_neg_360_idx" => Ok(Self::RoundaboutNeg360Idx), + "roundabout_generic_idx" => Ok(Self::RoundaboutGenericIdx), + "roundabout_neg_generic_idx" => Ok(Self::RoundaboutNegGenericIdx), + "sharp_turn_left_idx" => Ok(Self::SharpTurnLeftIdx), + "sharp_turn_right_idx" => Ok(Self::SharpTurnRightIdx), + "turn_left_idx" => Ok(Self::TurnLeftIdx), + "turn_right_idx" => Ok(Self::TurnRightIdx), + "uturn_left_idx" => Ok(Self::UturnLeftIdx), + "uturn_right_idx" => Ok(Self::UturnRightIdx), + "icon_inv_idx" => Ok(Self::IconInvIdx), + "icon_idx_cnt" => Ok(Self::IconIdxCnt), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for TurnType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum BikeLightBeamAngleMode { Manual, @@ -17196,6 +20971,21 @@ impl Serialize for BikeLightBeamAngleMode { } } } +impl FromStr for BikeLightBeamAngleMode { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "manual" => Ok(Self::Manual), + "auto" => Ok(Self::Auto), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for BikeLightBeamAngleMode { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum FitBaseUnit { Other, @@ -17260,6 +21050,22 @@ impl Serialize for FitBaseUnit { } } } +impl FromStr for FitBaseUnit { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "other" => Ok(Self::Other), + "kilogram" => Ok(Self::Kilogram), + "pound" => Ok(Self::Pound), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for FitBaseUnit { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SetType { Rest, @@ -17319,6 +21125,21 @@ impl Serialize for SetType { } } } +impl FromStr for SetType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "rest" => Ok(Self::Rest), + "active" => Ok(Self::Active), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SetType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum MaxMetCategory { Generic, @@ -17375,6 +21196,21 @@ impl Serialize for MaxMetCategory { serializer.serialize_str(&self.to_string()) } } +impl FromStr for MaxMetCategory { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "generic" => Ok(Self::Generic), + "cycling" => Ok(Self::Cycling), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for MaxMetCategory { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ExerciseCategory { BenchPress, @@ -17594,6 +21430,53 @@ impl Serialize for ExerciseCategory { } } } +impl FromStr for ExerciseCategory { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "bench_press" => Ok(Self::BenchPress), + "calf_raise" => Ok(Self::CalfRaise), + "cardio" => Ok(Self::Cardio), + "carry" => Ok(Self::Carry), + "chop" => Ok(Self::Chop), + "core" => Ok(Self::Core), + "crunch" => Ok(Self::Crunch), + "curl" => Ok(Self::Curl), + "deadlift" => Ok(Self::Deadlift), + "flye" => Ok(Self::Flye), + "hip_raise" => Ok(Self::HipRaise), + "hip_stability" => Ok(Self::HipStability), + "hip_swing" => Ok(Self::HipSwing), + "hyperextension" => Ok(Self::Hyperextension), + "lateral_raise" => Ok(Self::LateralRaise), + "leg_curl" => Ok(Self::LegCurl), + "leg_raise" => Ok(Self::LegRaise), + "lunge" => Ok(Self::Lunge), + "olympic_lift" => Ok(Self::OlympicLift), + "plank" => Ok(Self::Plank), + "plyo" => Ok(Self::Plyo), + "pull_up" => Ok(Self::PullUp), + "push_up" => Ok(Self::PushUp), + "row" => Ok(Self::Row), + "shoulder_press" => Ok(Self::ShoulderPress), + "shoulder_stability" => Ok(Self::ShoulderStability), + "shrug" => Ok(Self::Shrug), + "sit_up" => Ok(Self::SitUp), + "squat" => Ok(Self::Squat), + "total_body" => Ok(Self::TotalBody), + "triceps_extension" => Ok(Self::TricepsExtension), + "warm_up" => Ok(Self::WarmUp), + "run" => Ok(Self::Run), + "unknown" => Ok(Self::Unknown), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ExerciseCategory { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum BenchPressExerciseName { AlternatingDumbbellChestPressOnSwissBall, @@ -17818,6 +21701,50 @@ impl Serialize for BenchPressExerciseName { } } } +impl FromStr for BenchPressExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "alternating_dumbbell_chest_press_on_swiss_ball" => { + Ok(Self::AlternatingDumbbellChestPressOnSwissBall) + } + "barbell_bench_press" => Ok(Self::BarbellBenchPress), + "barbell_board_bench_press" => Ok(Self::BarbellBoardBenchPress), + "barbell_floor_press" => Ok(Self::BarbellFloorPress), + "close_grip_barbell_bench_press" => Ok(Self::CloseGripBarbellBenchPress), + "decline_dumbbell_bench_press" => Ok(Self::DeclineDumbbellBenchPress), + "dumbbell_bench_press" => Ok(Self::DumbbellBenchPress), + "dumbbell_floor_press" => Ok(Self::DumbbellFloorPress), + "incline_barbell_bench_press" => Ok(Self::InclineBarbellBenchPress), + "incline_dumbbell_bench_press" => Ok(Self::InclineDumbbellBenchPress), + "incline_smith_machine_bench_press" => Ok(Self::InclineSmithMachineBenchPress), + "isometric_barbell_bench_press" => Ok(Self::IsometricBarbellBenchPress), + "kettlebell_chest_press" => Ok(Self::KettlebellChestPress), + "neutral_grip_dumbbell_bench_press" => Ok(Self::NeutralGripDumbbellBenchPress), + "neutral_grip_dumbbell_incline_bench_press" => { + Ok(Self::NeutralGripDumbbellInclineBenchPress) + } + "one_arm_floor_press" => Ok(Self::OneArmFloorPress), + "weighted_one_arm_floor_press" => Ok(Self::WeightedOneArmFloorPress), + "partial_lockout" => Ok(Self::PartialLockout), + "reverse_grip_barbell_bench_press" => Ok(Self::ReverseGripBarbellBenchPress), + "reverse_grip_incline_bench_press" => Ok(Self::ReverseGripInclineBenchPress), + "single_arm_cable_chest_press" => Ok(Self::SingleArmCableChestPress), + "single_arm_dumbbell_bench_press" => Ok(Self::SingleArmDumbbellBenchPress), + "smith_machine_bench_press" => Ok(Self::SmithMachineBenchPress), + "swiss_ball_dumbbell_chest_press" => Ok(Self::SwissBallDumbbellChestPress), + "triple_stop_barbell_bench_press" => Ok(Self::TripleStopBarbellBenchPress), + "wide_grip_barbell_bench_press" => Ok(Self::WideGripBarbellBenchPress), + "alternating_dumbbell_chest_press" => Ok(Self::AlternatingDumbbellChestPress), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for BenchPressExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum CalfRaiseExerciseName { Name3WayCalfRaise, @@ -18004,6 +21931,44 @@ impl Serialize for CalfRaiseExerciseName { } } } +impl FromStr for CalfRaiseExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "3_way_calf_raise" => Ok(Self::Name3WayCalfRaise), + "3_way_weighted_calf_raise" => Ok(Self::Name3WayWeightedCalfRaise), + "3_way_single_leg_calf_raise" => Ok(Self::Name3WaySingleLegCalfRaise), + "3_way_weighted_single_leg_calf_raise" => Ok(Self::Name3WayWeightedSingleLegCalfRaise), + "donkey_calf_raise" => Ok(Self::DonkeyCalfRaise), + "weighted_donkey_calf_raise" => Ok(Self::WeightedDonkeyCalfRaise), + "seated_calf_raise" => Ok(Self::SeatedCalfRaise), + "weighted_seated_calf_raise" => Ok(Self::WeightedSeatedCalfRaise), + "seated_dumbbell_toe_raise" => Ok(Self::SeatedDumbbellToeRaise), + "single_leg_bent_knee_calf_raise" => Ok(Self::SingleLegBentKneeCalfRaise), + "weighted_single_leg_bent_knee_calf_raise" => { + Ok(Self::WeightedSingleLegBentKneeCalfRaise) + } + "single_leg_decline_push_up" => Ok(Self::SingleLegDeclinePushUp), + "single_leg_donkey_calf_raise" => Ok(Self::SingleLegDonkeyCalfRaise), + "weighted_single_leg_donkey_calf_raise" => Ok(Self::WeightedSingleLegDonkeyCalfRaise), + "single_leg_hip_raise_with_knee_hold" => Ok(Self::SingleLegHipRaiseWithKneeHold), + "single_leg_standing_calf_raise" => Ok(Self::SingleLegStandingCalfRaise), + "single_leg_standing_dumbbell_calf_raise" => { + Ok(Self::SingleLegStandingDumbbellCalfRaise) + } + "standing_barbell_calf_raise" => Ok(Self::StandingBarbellCalfRaise), + "standing_calf_raise" => Ok(Self::StandingCalfRaise), + "weighted_standing_calf_raise" => Ok(Self::WeightedStandingCalfRaise), + "standing_dumbbell_calf_raise" => Ok(Self::StandingDumbbellCalfRaise), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for CalfRaiseExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum CardioExerciseName { BobAndWeaveCircle, @@ -18167,6 +22132,41 @@ impl Serialize for CardioExerciseName { } } } +impl FromStr for CardioExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "bob_and_weave_circle" => Ok(Self::BobAndWeaveCircle), + "weighted_bob_and_weave_circle" => Ok(Self::WeightedBobAndWeaveCircle), + "cardio_core_crawl" => Ok(Self::CardioCoreCrawl), + "weighted_cardio_core_crawl" => Ok(Self::WeightedCardioCoreCrawl), + "double_under" => Ok(Self::DoubleUnder), + "weighted_double_under" => Ok(Self::WeightedDoubleUnder), + "jump_rope" => Ok(Self::JumpRope), + "weighted_jump_rope" => Ok(Self::WeightedJumpRope), + "jump_rope_crossover" => Ok(Self::JumpRopeCrossover), + "weighted_jump_rope_crossover" => Ok(Self::WeightedJumpRopeCrossover), + "jump_rope_jog" => Ok(Self::JumpRopeJog), + "weighted_jump_rope_jog" => Ok(Self::WeightedJumpRopeJog), + "jumping_jacks" => Ok(Self::JumpingJacks), + "weighted_jumping_jacks" => Ok(Self::WeightedJumpingJacks), + "ski_moguls" => Ok(Self::SkiMoguls), + "weighted_ski_moguls" => Ok(Self::WeightedSkiMoguls), + "split_jacks" => Ok(Self::SplitJacks), + "weighted_split_jacks" => Ok(Self::WeightedSplitJacks), + "squat_jacks" => Ok(Self::SquatJacks), + "weighted_squat_jacks" => Ok(Self::WeightedSquatJacks), + "triple_under" => Ok(Self::TripleUnder), + "weighted_triple_under" => Ok(Self::WeightedTripleUnder), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for CardioExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum CarryExerciseName { BarHolds, @@ -18241,6 +22241,24 @@ impl Serialize for CarryExerciseName { } } } +impl FromStr for CarryExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "bar_holds" => Ok(Self::BarHolds), + "farmers_walk" => Ok(Self::FarmersWalk), + "farmers_walk_on_toes" => Ok(Self::FarmersWalkOnToes), + "hex_dumbbell_hold" => Ok(Self::HexDumbbellHold), + "overhead_carry" => Ok(Self::OverheadCarry), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for CarryExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ChopExerciseName { CablePullThrough, @@ -18423,6 +22441,44 @@ impl Serialize for ChopExerciseName { } } } +impl FromStr for ChopExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "cable_pull_through" => Ok(Self::CablePullThrough), + "cable_rotational_lift" => Ok(Self::CableRotationalLift), + "cable_woodchop" => Ok(Self::CableWoodchop), + "cross_chop_to_knee" => Ok(Self::CrossChopToKnee), + "weighted_cross_chop_to_knee" => Ok(Self::WeightedCrossChopToKnee), + "dumbbell_chop" => Ok(Self::DumbbellChop), + "half_kneeling_rotation" => Ok(Self::HalfKneelingRotation), + "weighted_half_kneeling_rotation" => Ok(Self::WeightedHalfKneelingRotation), + "half_kneeling_rotational_chop" => Ok(Self::HalfKneelingRotationalChop), + "half_kneeling_rotational_reverse_chop" => Ok(Self::HalfKneelingRotationalReverseChop), + "half_kneeling_stability_chop" => Ok(Self::HalfKneelingStabilityChop), + "half_kneeling_stability_reverse_chop" => Ok(Self::HalfKneelingStabilityReverseChop), + "kneeling_rotational_chop" => Ok(Self::KneelingRotationalChop), + "kneeling_rotational_reverse_chop" => Ok(Self::KneelingRotationalReverseChop), + "kneeling_stability_chop" => Ok(Self::KneelingStabilityChop), + "kneeling_woodchopper" => Ok(Self::KneelingWoodchopper), + "medicine_ball_wood_chops" => Ok(Self::MedicineBallWoodChops), + "power_squat_chops" => Ok(Self::PowerSquatChops), + "weighted_power_squat_chops" => Ok(Self::WeightedPowerSquatChops), + "standing_rotational_chop" => Ok(Self::StandingRotationalChop), + "standing_split_rotational_chop" => Ok(Self::StandingSplitRotationalChop), + "standing_split_rotational_reverse_chop" => { + Ok(Self::StandingSplitRotationalReverseChop) + } + "standing_stability_reverse_chop" => Ok(Self::StandingStabilityReverseChop), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ChopExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum CoreExerciseName { AbsJabs, @@ -18858,6 +22914,92 @@ impl Serialize for CoreExerciseName { } } } +impl FromStr for CoreExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "abs_jabs" => Ok(Self::AbsJabs), + "weighted_abs_jabs" => Ok(Self::WeightedAbsJabs), + "alternating_plate_reach" => Ok(Self::AlternatingPlateReach), + "barbell_rollout" => Ok(Self::BarbellRollout), + "weighted_barbell_rollout" => Ok(Self::WeightedBarbellRollout), + "body_bar_oblique_twist" => Ok(Self::BodyBarObliqueTwist), + "cable_core_press" => Ok(Self::CableCorePress), + "cable_side_bend" => Ok(Self::CableSideBend), + "side_bend" => Ok(Self::SideBend), + "weighted_side_bend" => Ok(Self::WeightedSideBend), + "crescent_circle" => Ok(Self::CrescentCircle), + "weighted_crescent_circle" => Ok(Self::WeightedCrescentCircle), + "cycling_russian_twist" => Ok(Self::CyclingRussianTwist), + "weighted_cycling_russian_twist" => Ok(Self::WeightedCyclingRussianTwist), + "elevated_feet_russian_twist" => Ok(Self::ElevatedFeetRussianTwist), + "weighted_elevated_feet_russian_twist" => Ok(Self::WeightedElevatedFeetRussianTwist), + "half_turkish_get_up" => Ok(Self::HalfTurkishGetUp), + "kettlebell_windmill" => Ok(Self::KettlebellWindmill), + "kneeling_ab_wheel" => Ok(Self::KneelingAbWheel), + "weighted_kneeling_ab_wheel" => Ok(Self::WeightedKneelingAbWheel), + "modified_front_lever" => Ok(Self::ModifiedFrontLever), + "open_knee_tucks" => Ok(Self::OpenKneeTucks), + "weighted_open_knee_tucks" => Ok(Self::WeightedOpenKneeTucks), + "side_abs_leg_lift" => Ok(Self::SideAbsLegLift), + "weighted_side_abs_leg_lift" => Ok(Self::WeightedSideAbsLegLift), + "swiss_ball_jackknife" => Ok(Self::SwissBallJackknife), + "weighted_swiss_ball_jackknife" => Ok(Self::WeightedSwissBallJackknife), + "swiss_ball_pike" => Ok(Self::SwissBallPike), + "weighted_swiss_ball_pike" => Ok(Self::WeightedSwissBallPike), + "swiss_ball_rollout" => Ok(Self::SwissBallRollout), + "weighted_swiss_ball_rollout" => Ok(Self::WeightedSwissBallRollout), + "triangle_hip_press" => Ok(Self::TriangleHipPress), + "weighted_triangle_hip_press" => Ok(Self::WeightedTriangleHipPress), + "trx_suspended_jackknife" => Ok(Self::TrxSuspendedJackknife), + "weighted_trx_suspended_jackknife" => Ok(Self::WeightedTrxSuspendedJackknife), + "u_boat" => Ok(Self::UBoat), + "weighted_u_boat" => Ok(Self::WeightedUBoat), + "windmill_switches" => Ok(Self::WindmillSwitches), + "weighted_windmill_switches" => Ok(Self::WeightedWindmillSwitches), + "alternating_slide_out" => Ok(Self::AlternatingSlideOut), + "weighted_alternating_slide_out" => Ok(Self::WeightedAlternatingSlideOut), + "ghd_back_extensions" => Ok(Self::GhdBackExtensions), + "weighted_ghd_back_extensions" => Ok(Self::WeightedGhdBackExtensions), + "overhead_walk" => Ok(Self::OverheadWalk), + "inchworm" => Ok(Self::Inchworm), + "weighted_modified_front_lever" => Ok(Self::WeightedModifiedFrontLever), + "russian_twist" => Ok(Self::RussianTwist), + "abdominal_leg_rotations" => Ok(Self::AbdominalLegRotations), + "arm_and_leg_extension_on_knees" => Ok(Self::ArmAndLegExtensionOnKnees), + "bicycle" => Ok(Self::Bicycle), + "bicep_curl_with_leg_extension" => Ok(Self::BicepCurlWithLegExtension), + "cat_cow" => Ok(Self::CatCow), + "corkscrew" => Ok(Self::Corkscrew), + "criss_cross" => Ok(Self::CrissCross), + "criss_cross_with_ball" => Ok(Self::CrissCrossWithBall), + "double_leg_stretch" => Ok(Self::DoubleLegStretch), + "knee_folds" => Ok(Self::KneeFolds), + "lower_lift" => Ok(Self::LowerLift), + "neck_pull" => Ok(Self::NeckPull), + "pelvic_clocks" => Ok(Self::PelvicClocks), + "roll_over" => Ok(Self::RollOver), + "roll_up" => Ok(Self::RollUp), + "rolling" => Ok(Self::Rolling), + "rowing_1" => Ok(Self::Rowing1), + "rowing_2" => Ok(Self::Rowing2), + "scissors" => Ok(Self::Scissors), + "single_leg_circles" => Ok(Self::SingleLegCircles), + "single_leg_stretch" => Ok(Self::SingleLegStretch), + "snake_twist_1_and_2" => Ok(Self::SnakeTwist1And2), + "swan" => Ok(Self::Swan), + "swimming" => Ok(Self::Swimming), + "teaser" => Ok(Self::Teaser), + "the_hundred" => Ok(Self::TheHundred), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for CoreExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum CrunchExerciseName { BicycleCrunch, @@ -19392,6 +23534,118 @@ impl Serialize for CrunchExerciseName { } } } +impl FromStr for CrunchExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "bicycle_crunch" => Ok(Self::BicycleCrunch), + "cable_crunch" => Ok(Self::CableCrunch), + "circular_arm_crunch" => Ok(Self::CircularArmCrunch), + "crossed_arms_crunch" => Ok(Self::CrossedArmsCrunch), + "weighted_crossed_arms_crunch" => Ok(Self::WeightedCrossedArmsCrunch), + "cross_leg_reverse_crunch" => Ok(Self::CrossLegReverseCrunch), + "weighted_cross_leg_reverse_crunch" => Ok(Self::WeightedCrossLegReverseCrunch), + "crunch_chop" => Ok(Self::CrunchChop), + "weighted_crunch_chop" => Ok(Self::WeightedCrunchChop), + "double_crunch" => Ok(Self::DoubleCrunch), + "weighted_double_crunch" => Ok(Self::WeightedDoubleCrunch), + "elbow_to_knee_crunch" => Ok(Self::ElbowToKneeCrunch), + "weighted_elbow_to_knee_crunch" => Ok(Self::WeightedElbowToKneeCrunch), + "flutter_kicks" => Ok(Self::FlutterKicks), + "weighted_flutter_kicks" => Ok(Self::WeightedFlutterKicks), + "foam_roller_reverse_crunch_on_bench" => Ok(Self::FoamRollerReverseCrunchOnBench), + "weighted_foam_roller_reverse_crunch_on_bench" => { + Ok(Self::WeightedFoamRollerReverseCrunchOnBench) + } + "foam_roller_reverse_crunch_with_dumbbell" => { + Ok(Self::FoamRollerReverseCrunchWithDumbbell) + } + "foam_roller_reverse_crunch_with_medicine_ball" => { + Ok(Self::FoamRollerReverseCrunchWithMedicineBall) + } + "frog_press" => Ok(Self::FrogPress), + "hanging_knee_raise_oblique_crunch" => Ok(Self::HangingKneeRaiseObliqueCrunch), + "weighted_hanging_knee_raise_oblique_crunch" => { + Ok(Self::WeightedHangingKneeRaiseObliqueCrunch) + } + "hip_crossover" => Ok(Self::HipCrossover), + "weighted_hip_crossover" => Ok(Self::WeightedHipCrossover), + "hollow_rock" => Ok(Self::HollowRock), + "weighted_hollow_rock" => Ok(Self::WeightedHollowRock), + "incline_reverse_crunch" => Ok(Self::InclineReverseCrunch), + "weighted_incline_reverse_crunch" => Ok(Self::WeightedInclineReverseCrunch), + "kneeling_cable_crunch" => Ok(Self::KneelingCableCrunch), + "kneeling_cross_crunch" => Ok(Self::KneelingCrossCrunch), + "weighted_kneeling_cross_crunch" => Ok(Self::WeightedKneelingCrossCrunch), + "kneeling_oblique_cable_crunch" => Ok(Self::KneelingObliqueCableCrunch), + "knees_to_elbow" => Ok(Self::KneesToElbow), + "leg_extensions" => Ok(Self::LegExtensions), + "weighted_leg_extensions" => Ok(Self::WeightedLegExtensions), + "leg_levers" => Ok(Self::LegLevers), + "mcgill_curl_up" => Ok(Self::McgillCurlUp), + "weighted_mcgill_curl_up" => Ok(Self::WeightedMcgillCurlUp), + "modified_pilates_roll_up_with_ball" => Ok(Self::ModifiedPilatesRollUpWithBall), + "weighted_modified_pilates_roll_up_with_ball" => { + Ok(Self::WeightedModifiedPilatesRollUpWithBall) + } + "pilates_crunch" => Ok(Self::PilatesCrunch), + "weighted_pilates_crunch" => Ok(Self::WeightedPilatesCrunch), + "pilates_roll_up_with_ball" => Ok(Self::PilatesRollUpWithBall), + "weighted_pilates_roll_up_with_ball" => Ok(Self::WeightedPilatesRollUpWithBall), + "raised_legs_crunch" => Ok(Self::RaisedLegsCrunch), + "weighted_raised_legs_crunch" => Ok(Self::WeightedRaisedLegsCrunch), + "reverse_crunch" => Ok(Self::ReverseCrunch), + "weighted_reverse_crunch" => Ok(Self::WeightedReverseCrunch), + "reverse_crunch_on_a_bench" => Ok(Self::ReverseCrunchOnABench), + "weighted_reverse_crunch_on_a_bench" => Ok(Self::WeightedReverseCrunchOnABench), + "reverse_curl_and_lift" => Ok(Self::ReverseCurlAndLift), + "weighted_reverse_curl_and_lift" => Ok(Self::WeightedReverseCurlAndLift), + "rotational_lift" => Ok(Self::RotationalLift), + "weighted_rotational_lift" => Ok(Self::WeightedRotationalLift), + "seated_alternating_reverse_crunch" => Ok(Self::SeatedAlternatingReverseCrunch), + "weighted_seated_alternating_reverse_crunch" => { + Ok(Self::WeightedSeatedAlternatingReverseCrunch) + } + "seated_leg_u" => Ok(Self::SeatedLegU), + "weighted_seated_leg_u" => Ok(Self::WeightedSeatedLegU), + "side_to_side_crunch_and_weave" => Ok(Self::SideToSideCrunchAndWeave), + "weighted_side_to_side_crunch_and_weave" => Ok(Self::WeightedSideToSideCrunchAndWeave), + "single_leg_reverse_crunch" => Ok(Self::SingleLegReverseCrunch), + "weighted_single_leg_reverse_crunch" => Ok(Self::WeightedSingleLegReverseCrunch), + "skater_crunch_cross" => Ok(Self::SkaterCrunchCross), + "weighted_skater_crunch_cross" => Ok(Self::WeightedSkaterCrunchCross), + "standing_cable_crunch" => Ok(Self::StandingCableCrunch), + "standing_side_crunch" => Ok(Self::StandingSideCrunch), + "step_climb" => Ok(Self::StepClimb), + "weighted_step_climb" => Ok(Self::WeightedStepClimb), + "swiss_ball_crunch" => Ok(Self::SwissBallCrunch), + "swiss_ball_reverse_crunch" => Ok(Self::SwissBallReverseCrunch), + "weighted_swiss_ball_reverse_crunch" => Ok(Self::WeightedSwissBallReverseCrunch), + "swiss_ball_russian_twist" => Ok(Self::SwissBallRussianTwist), + "weighted_swiss_ball_russian_twist" => Ok(Self::WeightedSwissBallRussianTwist), + "swiss_ball_side_crunch" => Ok(Self::SwissBallSideCrunch), + "weighted_swiss_ball_side_crunch" => Ok(Self::WeightedSwissBallSideCrunch), + "thoracic_crunches_on_foam_roller" => Ok(Self::ThoracicCrunchesOnFoamRoller), + "weighted_thoracic_crunches_on_foam_roller" => { + Ok(Self::WeightedThoracicCrunchesOnFoamRoller) + } + "triceps_crunch" => Ok(Self::TricepsCrunch), + "weighted_bicycle_crunch" => Ok(Self::WeightedBicycleCrunch), + "weighted_crunch" => Ok(Self::WeightedCrunch), + "weighted_swiss_ball_crunch" => Ok(Self::WeightedSwissBallCrunch), + "toes_to_bar" => Ok(Self::ToesToBar), + "weighted_toes_to_bar" => Ok(Self::WeightedToesToBar), + "crunch" => Ok(Self::Crunch), + "straight_leg_crunch_with_ball" => Ok(Self::StraightLegCrunchWithBall), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for CrunchExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum CurlExerciseName { AlternatingDumbbellBicepsCurl, @@ -19703,6 +23957,77 @@ impl Serialize for CurlExerciseName { } } } +impl FromStr for CurlExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "alternating_dumbbell_biceps_curl" => Ok(Self::AlternatingDumbbellBicepsCurl), + "alternating_dumbbell_biceps_curl_on_swiss_ball" => { + Ok(Self::AlternatingDumbbellBicepsCurlOnSwissBall) + } + "alternating_incline_dumbbell_biceps_curl" => { + Ok(Self::AlternatingInclineDumbbellBicepsCurl) + } + "barbell_biceps_curl" => Ok(Self::BarbellBicepsCurl), + "barbell_reverse_wrist_curl" => Ok(Self::BarbellReverseWristCurl), + "barbell_wrist_curl" => Ok(Self::BarbellWristCurl), + "behind_the_back_barbell_reverse_wrist_curl" => { + Ok(Self::BehindTheBackBarbellReverseWristCurl) + } + "behind_the_back_one_arm_cable_curl" => Ok(Self::BehindTheBackOneArmCableCurl), + "cable_biceps_curl" => Ok(Self::CableBicepsCurl), + "cable_hammer_curl" => Ok(Self::CableHammerCurl), + "cheating_barbell_biceps_curl" => Ok(Self::CheatingBarbellBicepsCurl), + "close_grip_ez_bar_biceps_curl" => Ok(Self::CloseGripEzBarBicepsCurl), + "cross_body_dumbbell_hammer_curl" => Ok(Self::CrossBodyDumbbellHammerCurl), + "dead_hang_biceps_curl" => Ok(Self::DeadHangBicepsCurl), + "decline_hammer_curl" => Ok(Self::DeclineHammerCurl), + "dumbbell_biceps_curl_with_static_hold" => Ok(Self::DumbbellBicepsCurlWithStaticHold), + "dumbbell_hammer_curl" => Ok(Self::DumbbellHammerCurl), + "dumbbell_reverse_wrist_curl" => Ok(Self::DumbbellReverseWristCurl), + "dumbbell_wrist_curl" => Ok(Self::DumbbellWristCurl), + "ez_bar_preacher_curl" => Ok(Self::EzBarPreacherCurl), + "forward_bend_biceps_curl" => Ok(Self::ForwardBendBicepsCurl), + "hammer_curl_to_press" => Ok(Self::HammerCurlToPress), + "incline_dumbbell_biceps_curl" => Ok(Self::InclineDumbbellBicepsCurl), + "incline_offset_thumb_dumbbell_curl" => Ok(Self::InclineOffsetThumbDumbbellCurl), + "kettlebell_biceps_curl" => Ok(Self::KettlebellBicepsCurl), + "lying_concentration_cable_curl" => Ok(Self::LyingConcentrationCableCurl), + "one_arm_preacher_curl" => Ok(Self::OneArmPreacherCurl), + "plate_pinch_curl" => Ok(Self::PlatePinchCurl), + "preacher_curl_with_cable" => Ok(Self::PreacherCurlWithCable), + "reverse_ez_bar_curl" => Ok(Self::ReverseEzBarCurl), + "reverse_grip_wrist_curl" => Ok(Self::ReverseGripWristCurl), + "reverse_grip_barbell_biceps_curl" => Ok(Self::ReverseGripBarbellBicepsCurl), + "seated_alternating_dumbbell_biceps_curl" => { + Ok(Self::SeatedAlternatingDumbbellBicepsCurl) + } + "seated_dumbbell_biceps_curl" => Ok(Self::SeatedDumbbellBicepsCurl), + "seated_reverse_dumbbell_curl" => Ok(Self::SeatedReverseDumbbellCurl), + "split_stance_offset_pinky_dumbbell_curl" => { + Ok(Self::SplitStanceOffsetPinkyDumbbellCurl) + } + "standing_alternating_dumbbell_curls" => Ok(Self::StandingAlternatingDumbbellCurls), + "standing_dumbbell_biceps_curl" => Ok(Self::StandingDumbbellBicepsCurl), + "standing_ez_bar_biceps_curl" => Ok(Self::StandingEzBarBicepsCurl), + "static_curl" => Ok(Self::StaticCurl), + "swiss_ball_dumbbell_overhead_triceps_extension" => { + Ok(Self::SwissBallDumbbellOverheadTricepsExtension) + } + "swiss_ball_ez_bar_preacher_curl" => Ok(Self::SwissBallEzBarPreacherCurl), + "twisting_standing_dumbbell_biceps_curl" => { + Ok(Self::TwistingStandingDumbbellBicepsCurl) + } + "wide_grip_ez_bar_biceps_curl" => Ok(Self::WideGripEzBarBicepsCurl), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for CurlExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DeadliftExerciseName { BarbellDeadlift, @@ -19865,6 +24190,44 @@ impl Serialize for DeadliftExerciseName { } } } +impl FromStr for DeadliftExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "barbell_deadlift" => Ok(Self::BarbellDeadlift), + "barbell_straight_leg_deadlift" => Ok(Self::BarbellStraightLegDeadlift), + "dumbbell_deadlift" => Ok(Self::DumbbellDeadlift), + "dumbbell_single_leg_deadlift_to_row" => Ok(Self::DumbbellSingleLegDeadliftToRow), + "dumbbell_straight_leg_deadlift" => Ok(Self::DumbbellStraightLegDeadlift), + "kettlebell_floor_to_shelf" => Ok(Self::KettlebellFloorToShelf), + "one_arm_one_leg_deadlift" => Ok(Self::OneArmOneLegDeadlift), + "rack_pull" => Ok(Self::RackPull), + "rotational_dumbbell_straight_leg_deadlift" => { + Ok(Self::RotationalDumbbellStraightLegDeadlift) + } + "single_arm_deadlift" => Ok(Self::SingleArmDeadlift), + "single_leg_barbell_deadlift" => Ok(Self::SingleLegBarbellDeadlift), + "single_leg_barbell_straight_leg_deadlift" => { + Ok(Self::SingleLegBarbellStraightLegDeadlift) + } + "single_leg_deadlift_with_barbell" => Ok(Self::SingleLegDeadliftWithBarbell), + "single_leg_rdl_circuit" => Ok(Self::SingleLegRdlCircuit), + "single_leg_romanian_deadlift_with_dumbbell" => { + Ok(Self::SingleLegRomanianDeadliftWithDumbbell) + } + "sumo_deadlift" => Ok(Self::SumoDeadlift), + "sumo_deadlift_high_pull" => Ok(Self::SumoDeadliftHighPull), + "trap_bar_deadlift" => Ok(Self::TrapBarDeadlift), + "wide_grip_barbell_deadlift" => Ok(Self::WideGripBarbellDeadlift), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DeadliftExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum FlyeExerciseName { CableCrossover, @@ -19966,6 +24329,29 @@ impl Serialize for FlyeExerciseName { } } } +impl FromStr for FlyeExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "cable_crossover" => Ok(Self::CableCrossover), + "decline_dumbbell_flye" => Ok(Self::DeclineDumbbellFlye), + "dumbbell_flye" => Ok(Self::DumbbellFlye), + "incline_dumbbell_flye" => Ok(Self::InclineDumbbellFlye), + "kettlebell_flye" => Ok(Self::KettlebellFlye), + "kneeling_rear_flye" => Ok(Self::KneelingRearFlye), + "single_arm_standing_cable_reverse_flye" => Ok(Self::SingleArmStandingCableReverseFlye), + "swiss_ball_dumbbell_flye" => Ok(Self::SwissBallDumbbellFlye), + "arm_rotations" => Ok(Self::ArmRotations), + "hug_a_tree" => Ok(Self::HugATree), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for FlyeExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum HipRaiseExerciseName { BarbellHipThrustOnFloor, @@ -20336,6 +24722,101 @@ impl Serialize for HipRaiseExerciseName { } } } +impl FromStr for HipRaiseExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "barbell_hip_thrust_on_floor" => Ok(Self::BarbellHipThrustOnFloor), + "barbell_hip_thrust_with_bench" => Ok(Self::BarbellHipThrustWithBench), + "bent_knee_swiss_ball_reverse_hip_raise" => Ok(Self::BentKneeSwissBallReverseHipRaise), + "weighted_bent_knee_swiss_ball_reverse_hip_raise" => { + Ok(Self::WeightedBentKneeSwissBallReverseHipRaise) + } + "bridge_with_leg_extension" => Ok(Self::BridgeWithLegExtension), + "weighted_bridge_with_leg_extension" => Ok(Self::WeightedBridgeWithLegExtension), + "clam_bridge" => Ok(Self::ClamBridge), + "front_kick_tabletop" => Ok(Self::FrontKickTabletop), + "weighted_front_kick_tabletop" => Ok(Self::WeightedFrontKickTabletop), + "hip_extension_and_cross" => Ok(Self::HipExtensionAndCross), + "weighted_hip_extension_and_cross" => Ok(Self::WeightedHipExtensionAndCross), + "hip_raise" => Ok(Self::HipRaise), + "weighted_hip_raise" => Ok(Self::WeightedHipRaise), + "hip_raise_with_feet_on_swiss_ball" => Ok(Self::HipRaiseWithFeetOnSwissBall), + "weighted_hip_raise_with_feet_on_swiss_ball" => { + Ok(Self::WeightedHipRaiseWithFeetOnSwissBall) + } + "hip_raise_with_head_on_bosu_ball" => Ok(Self::HipRaiseWithHeadOnBosuBall), + "weighted_hip_raise_with_head_on_bosu_ball" => { + Ok(Self::WeightedHipRaiseWithHeadOnBosuBall) + } + "hip_raise_with_head_on_swiss_ball" => Ok(Self::HipRaiseWithHeadOnSwissBall), + "weighted_hip_raise_with_head_on_swiss_ball" => { + Ok(Self::WeightedHipRaiseWithHeadOnSwissBall) + } + "hip_raise_with_knee_squeeze" => Ok(Self::HipRaiseWithKneeSqueeze), + "weighted_hip_raise_with_knee_squeeze" => Ok(Self::WeightedHipRaiseWithKneeSqueeze), + "incline_rear_leg_extension" => Ok(Self::InclineRearLegExtension), + "weighted_incline_rear_leg_extension" => Ok(Self::WeightedInclineRearLegExtension), + "kettlebell_swing" => Ok(Self::KettlebellSwing), + "marching_hip_raise" => Ok(Self::MarchingHipRaise), + "weighted_marching_hip_raise" => Ok(Self::WeightedMarchingHipRaise), + "marching_hip_raise_with_feet_on_a_swiss_ball" => { + Ok(Self::MarchingHipRaiseWithFeetOnASwissBall) + } + "weighted_marching_hip_raise_with_feet_on_a_swiss_ball" => { + Ok(Self::WeightedMarchingHipRaiseWithFeetOnASwissBall) + } + "reverse_hip_raise" => Ok(Self::ReverseHipRaise), + "weighted_reverse_hip_raise" => Ok(Self::WeightedReverseHipRaise), + "single_leg_hip_raise" => Ok(Self::SingleLegHipRaise), + "weighted_single_leg_hip_raise" => Ok(Self::WeightedSingleLegHipRaise), + "single_leg_hip_raise_with_foot_on_bench" => Ok(Self::SingleLegHipRaiseWithFootOnBench), + "weighted_single_leg_hip_raise_with_foot_on_bench" => { + Ok(Self::WeightedSingleLegHipRaiseWithFootOnBench) + } + "single_leg_hip_raise_with_foot_on_bosu_ball" => { + Ok(Self::SingleLegHipRaiseWithFootOnBosuBall) + } + "weighted_single_leg_hip_raise_with_foot_on_bosu_ball" => { + Ok(Self::WeightedSingleLegHipRaiseWithFootOnBosuBall) + } + "single_leg_hip_raise_with_foot_on_foam_roller" => { + Ok(Self::SingleLegHipRaiseWithFootOnFoamRoller) + } + "weighted_single_leg_hip_raise_with_foot_on_foam_roller" => { + Ok(Self::WeightedSingleLegHipRaiseWithFootOnFoamRoller) + } + "single_leg_hip_raise_with_foot_on_medicine_ball" => { + Ok(Self::SingleLegHipRaiseWithFootOnMedicineBall) + } + "weighted_single_leg_hip_raise_with_foot_on_medicine_ball" => { + Ok(Self::WeightedSingleLegHipRaiseWithFootOnMedicineBall) + } + "single_leg_hip_raise_with_head_on_bosu_ball" => { + Ok(Self::SingleLegHipRaiseWithHeadOnBosuBall) + } + "weighted_single_leg_hip_raise_with_head_on_bosu_ball" => { + Ok(Self::WeightedSingleLegHipRaiseWithHeadOnBosuBall) + } + "weighted_clam_bridge" => Ok(Self::WeightedClamBridge), + "single_leg_swiss_ball_hip_raise_and_leg_curl" => { + Ok(Self::SingleLegSwissBallHipRaiseAndLegCurl) + } + "clams" => Ok(Self::Clams), + "inner_thigh_circles" => Ok(Self::InnerThighCircles), + "inner_thigh_side_lift" => Ok(Self::InnerThighSideLift), + "leg_circles" => Ok(Self::LegCircles), + "leg_lift" => Ok(Self::LegLift), + "leg_lift_in_external_rotation" => Ok(Self::LegLiftInExternalRotation), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for HipRaiseExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum HipStabilityExerciseName { BandSideLyingLegRaise, @@ -20591,6 +25072,53 @@ impl Serialize for HipStabilityExerciseName { } } } +impl FromStr for HipStabilityExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "band_side_lying_leg_raise" => Ok(Self::BandSideLyingLegRaise), + "dead_bug" => Ok(Self::DeadBug), + "weighted_dead_bug" => Ok(Self::WeightedDeadBug), + "external_hip_raise" => Ok(Self::ExternalHipRaise), + "weighted_external_hip_raise" => Ok(Self::WeightedExternalHipRaise), + "fire_hydrant_kicks" => Ok(Self::FireHydrantKicks), + "weighted_fire_hydrant_kicks" => Ok(Self::WeightedFireHydrantKicks), + "hip_circles" => Ok(Self::HipCircles), + "weighted_hip_circles" => Ok(Self::WeightedHipCircles), + "inner_thigh_lift" => Ok(Self::InnerThighLift), + "weighted_inner_thigh_lift" => Ok(Self::WeightedInnerThighLift), + "lateral_walks_with_band_at_ankles" => Ok(Self::LateralWalksWithBandAtAnkles), + "pretzel_side_kick" => Ok(Self::PretzelSideKick), + "weighted_pretzel_side_kick" => Ok(Self::WeightedPretzelSideKick), + "prone_hip_internal_rotation" => Ok(Self::ProneHipInternalRotation), + "weighted_prone_hip_internal_rotation" => Ok(Self::WeightedProneHipInternalRotation), + "quadruped" => Ok(Self::Quadruped), + "quadruped_hip_extension" => Ok(Self::QuadrupedHipExtension), + "weighted_quadruped_hip_extension" => Ok(Self::WeightedQuadrupedHipExtension), + "quadruped_with_leg_lift" => Ok(Self::QuadrupedWithLegLift), + "weighted_quadruped_with_leg_lift" => Ok(Self::WeightedQuadrupedWithLegLift), + "side_lying_leg_raise" => Ok(Self::SideLyingLegRaise), + "weighted_side_lying_leg_raise" => Ok(Self::WeightedSideLyingLegRaise), + "sliding_hip_adduction" => Ok(Self::SlidingHipAdduction), + "weighted_sliding_hip_adduction" => Ok(Self::WeightedSlidingHipAdduction), + "standing_adduction" => Ok(Self::StandingAdduction), + "weighted_standing_adduction" => Ok(Self::WeightedStandingAdduction), + "standing_cable_hip_abduction" => Ok(Self::StandingCableHipAbduction), + "standing_hip_abduction" => Ok(Self::StandingHipAbduction), + "weighted_standing_hip_abduction" => Ok(Self::WeightedStandingHipAbduction), + "standing_rear_leg_raise" => Ok(Self::StandingRearLegRaise), + "weighted_standing_rear_leg_raise" => Ok(Self::WeightedStandingRearLegRaise), + "supine_hip_internal_rotation" => Ok(Self::SupineHipInternalRotation), + "weighted_supine_hip_internal_rotation" => Ok(Self::WeightedSupineHipInternalRotation), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for HipStabilityExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum HipSwingExerciseName { SingleArmKettlebellSwing, @@ -20657,6 +25185,22 @@ impl Serialize for HipSwingExerciseName { } } } +impl FromStr for HipSwingExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "single_arm_kettlebell_swing" => Ok(Self::SingleArmKettlebellSwing), + "single_arm_dumbbell_swing" => Ok(Self::SingleArmDumbbellSwing), + "step_out_swing" => Ok(Self::StepOutSwing), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for HipSwingExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum HyperextensionExerciseName { BackExtensionWithOppositeArmAndLegReach, @@ -20949,6 +25493,67 @@ impl Serialize for HyperextensionExerciseName { } } } +impl FromStr for HyperextensionExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "back_extension_with_opposite_arm_and_leg_reach" => { + Ok(Self::BackExtensionWithOppositeArmAndLegReach) + } + "weighted_back_extension_with_opposite_arm_and_leg_reach" => { + Ok(Self::WeightedBackExtensionWithOppositeArmAndLegReach) + } + "base_rotations" => Ok(Self::BaseRotations), + "weighted_base_rotations" => Ok(Self::WeightedBaseRotations), + "bent_knee_reverse_hyperextension" => Ok(Self::BentKneeReverseHyperextension), + "weighted_bent_knee_reverse_hyperextension" => { + Ok(Self::WeightedBentKneeReverseHyperextension) + } + "hollow_hold_and_roll" => Ok(Self::HollowHoldAndRoll), + "weighted_hollow_hold_and_roll" => Ok(Self::WeightedHollowHoldAndRoll), + "kicks" => Ok(Self::Kicks), + "weighted_kicks" => Ok(Self::WeightedKicks), + "knee_raises" => Ok(Self::KneeRaises), + "weighted_knee_raises" => Ok(Self::WeightedKneeRaises), + "kneeling_superman" => Ok(Self::KneelingSuperman), + "weighted_kneeling_superman" => Ok(Self::WeightedKneelingSuperman), + "lat_pull_down_with_row" => Ok(Self::LatPullDownWithRow), + "medicine_ball_deadlift_to_reach" => Ok(Self::MedicineBallDeadliftToReach), + "one_arm_one_leg_row" => Ok(Self::OneArmOneLegRow), + "one_arm_row_with_band" => Ok(Self::OneArmRowWithBand), + "overhead_lunge_with_medicine_ball" => Ok(Self::OverheadLungeWithMedicineBall), + "plank_knee_tucks" => Ok(Self::PlankKneeTucks), + "weighted_plank_knee_tucks" => Ok(Self::WeightedPlankKneeTucks), + "side_step" => Ok(Self::SideStep), + "weighted_side_step" => Ok(Self::WeightedSideStep), + "single_leg_back_extension" => Ok(Self::SingleLegBackExtension), + "weighted_single_leg_back_extension" => Ok(Self::WeightedSingleLegBackExtension), + "spine_extension" => Ok(Self::SpineExtension), + "weighted_spine_extension" => Ok(Self::WeightedSpineExtension), + "static_back_extension" => Ok(Self::StaticBackExtension), + "weighted_static_back_extension" => Ok(Self::WeightedStaticBackExtension), + "superman_from_floor" => Ok(Self::SupermanFromFloor), + "weighted_superman_from_floor" => Ok(Self::WeightedSupermanFromFloor), + "swiss_ball_back_extension" => Ok(Self::SwissBallBackExtension), + "weighted_swiss_ball_back_extension" => Ok(Self::WeightedSwissBallBackExtension), + "swiss_ball_hyperextension" => Ok(Self::SwissBallHyperextension), + "weighted_swiss_ball_hyperextension" => Ok(Self::WeightedSwissBallHyperextension), + "swiss_ball_opposite_arm_and_leg_lift" => Ok(Self::SwissBallOppositeArmAndLegLift), + "weighted_swiss_ball_opposite_arm_and_leg_lift" => { + Ok(Self::WeightedSwissBallOppositeArmAndLegLift) + } + "superman_on_swiss_ball" => Ok(Self::SupermanOnSwissBall), + "cobra" => Ok(Self::Cobra), + "supine_floor_barre" => Ok(Self::SupineFloorBarre), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for HyperextensionExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LateralRaiseExerciseName { Name45DegreeCableExternalRotation, @@ -21184,6 +25789,55 @@ impl Serialize for LateralRaiseExerciseName { } } } +impl FromStr for LateralRaiseExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "45_degree_cable_external_rotation" => Ok(Self::Name45DegreeCableExternalRotation), + "alternating_lateral_raise_with_static_hold" => { + Ok(Self::AlternatingLateralRaiseWithStaticHold) + } + "bar_muscle_up" => Ok(Self::BarMuscleUp), + "bent_over_lateral_raise" => Ok(Self::BentOverLateralRaise), + "cable_diagonal_raise" => Ok(Self::CableDiagonalRaise), + "cable_front_raise" => Ok(Self::CableFrontRaise), + "calorie_row" => Ok(Self::CalorieRow), + "combo_shoulder_raise" => Ok(Self::ComboShoulderRaise), + "dumbbell_diagonal_raise" => Ok(Self::DumbbellDiagonalRaise), + "dumbbell_v_raise" => Ok(Self::DumbbellVRaise), + "front_raise" => Ok(Self::FrontRaise), + "leaning_dumbbell_lateral_raise" => Ok(Self::LeaningDumbbellLateralRaise), + "lying_dumbbell_raise" => Ok(Self::LyingDumbbellRaise), + "muscle_up" => Ok(Self::MuscleUp), + "one_arm_cable_lateral_raise" => Ok(Self::OneArmCableLateralRaise), + "overhand_grip_rear_lateral_raise" => Ok(Self::OverhandGripRearLateralRaise), + "plate_raises" => Ok(Self::PlateRaises), + "ring_dip" => Ok(Self::RingDip), + "weighted_ring_dip" => Ok(Self::WeightedRingDip), + "ring_muscle_up" => Ok(Self::RingMuscleUp), + "weighted_ring_muscle_up" => Ok(Self::WeightedRingMuscleUp), + "rope_climb" => Ok(Self::RopeClimb), + "weighted_rope_climb" => Ok(Self::WeightedRopeClimb), + "scaption" => Ok(Self::Scaption), + "seated_lateral_raise" => Ok(Self::SeatedLateralRaise), + "seated_rear_lateral_raise" => Ok(Self::SeatedRearLateralRaise), + "side_lying_lateral_raise" => Ok(Self::SideLyingLateralRaise), + "standing_lift" => Ok(Self::StandingLift), + "suspended_row" => Ok(Self::SuspendedRow), + "underhand_grip_rear_lateral_raise" => Ok(Self::UnderhandGripRearLateralRaise), + "wall_slide" => Ok(Self::WallSlide), + "weighted_wall_slide" => Ok(Self::WeightedWallSlide), + "arm_circles" => Ok(Self::ArmCircles), + "shaving_the_head" => Ok(Self::ShavingTheHead), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LateralRaiseExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LegCurlExerciseName { LegCurl, @@ -21303,6 +25957,31 @@ impl Serialize for LegCurlExerciseName { } } } +impl FromStr for LegCurlExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "leg_curl" => Ok(Self::LegCurl), + "weighted_leg_curl" => Ok(Self::WeightedLegCurl), + "good_morning" => Ok(Self::GoodMorning), + "seated_barbell_good_morning" => Ok(Self::SeatedBarbellGoodMorning), + "single_leg_barbell_good_morning" => Ok(Self::SingleLegBarbellGoodMorning), + "single_leg_sliding_leg_curl" => Ok(Self::SingleLegSlidingLegCurl), + "sliding_leg_curl" => Ok(Self::SlidingLegCurl), + "split_barbell_good_morning" => Ok(Self::SplitBarbellGoodMorning), + "split_stance_extension" => Ok(Self::SplitStanceExtension), + "staggered_stance_good_morning" => Ok(Self::StaggeredStanceGoodMorning), + "swiss_ball_hip_raise_and_leg_curl" => Ok(Self::SwissBallHipRaiseAndLegCurl), + "zercher_good_morning" => Ok(Self::ZercherGoodMorning), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LegCurlExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LegRaiseExerciseName { HangingKneeRaise, @@ -21482,6 +26161,43 @@ impl Serialize for LegRaiseExerciseName { } } } +impl FromStr for LegRaiseExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "hanging_knee_raise" => Ok(Self::HangingKneeRaise), + "hanging_leg_raise" => Ok(Self::HangingLegRaise), + "weighted_hanging_leg_raise" => Ok(Self::WeightedHangingLegRaise), + "hanging_single_leg_raise" => Ok(Self::HangingSingleLegRaise), + "weighted_hanging_single_leg_raise" => Ok(Self::WeightedHangingSingleLegRaise), + "kettlebell_leg_raises" => Ok(Self::KettlebellLegRaises), + "leg_lowering_drill" => Ok(Self::LegLoweringDrill), + "weighted_leg_lowering_drill" => Ok(Self::WeightedLegLoweringDrill), + "lying_straight_leg_raise" => Ok(Self::LyingStraightLegRaise), + "weighted_lying_straight_leg_raise" => Ok(Self::WeightedLyingStraightLegRaise), + "medicine_ball_leg_drops" => Ok(Self::MedicineBallLegDrops), + "quadruped_leg_raise" => Ok(Self::QuadrupedLegRaise), + "weighted_quadruped_leg_raise" => Ok(Self::WeightedQuadrupedLegRaise), + "reverse_leg_raise" => Ok(Self::ReverseLegRaise), + "weighted_reverse_leg_raise" => Ok(Self::WeightedReverseLegRaise), + "reverse_leg_raise_on_swiss_ball" => Ok(Self::ReverseLegRaiseOnSwissBall), + "weighted_reverse_leg_raise_on_swiss_ball" => { + Ok(Self::WeightedReverseLegRaiseOnSwissBall) + } + "single_leg_lowering_drill" => Ok(Self::SingleLegLoweringDrill), + "weighted_single_leg_lowering_drill" => Ok(Self::WeightedSingleLegLoweringDrill), + "weighted_hanging_knee_raise" => Ok(Self::WeightedHangingKneeRaise), + "lateral_stepover" => Ok(Self::LateralStepover), + "weighted_lateral_stepover" => Ok(Self::WeightedLateralStepover), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LegRaiseExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum LungeExerciseName { OverheadLunge, @@ -21996,6 +26712,114 @@ impl Serialize for LungeExerciseName { } } } +impl FromStr for LungeExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "overhead_lunge" => Ok(Self::OverheadLunge), + "lunge_matrix" => Ok(Self::LungeMatrix), + "weighted_lunge_matrix" => Ok(Self::WeightedLungeMatrix), + "alternating_barbell_forward_lunge" => Ok(Self::AlternatingBarbellForwardLunge), + "alternating_dumbbell_lunge_with_reach" => Ok(Self::AlternatingDumbbellLungeWithReach), + "back_foot_elevated_dumbbell_split_squat" => { + Ok(Self::BackFootElevatedDumbbellSplitSquat) + } + "barbell_box_lunge" => Ok(Self::BarbellBoxLunge), + "barbell_bulgarian_split_squat" => Ok(Self::BarbellBulgarianSplitSquat), + "barbell_crossover_lunge" => Ok(Self::BarbellCrossoverLunge), + "barbell_front_split_squat" => Ok(Self::BarbellFrontSplitSquat), + "barbell_lunge" => Ok(Self::BarbellLunge), + "barbell_reverse_lunge" => Ok(Self::BarbellReverseLunge), + "barbell_side_lunge" => Ok(Self::BarbellSideLunge), + "barbell_split_squat" => Ok(Self::BarbellSplitSquat), + "core_control_rear_lunge" => Ok(Self::CoreControlRearLunge), + "diagonal_lunge" => Ok(Self::DiagonalLunge), + "drop_lunge" => Ok(Self::DropLunge), + "dumbbell_box_lunge" => Ok(Self::DumbbellBoxLunge), + "dumbbell_bulgarian_split_squat" => Ok(Self::DumbbellBulgarianSplitSquat), + "dumbbell_crossover_lunge" => Ok(Self::DumbbellCrossoverLunge), + "dumbbell_diagonal_lunge" => Ok(Self::DumbbellDiagonalLunge), + "dumbbell_lunge" => Ok(Self::DumbbellLunge), + "dumbbell_lunge_and_rotation" => Ok(Self::DumbbellLungeAndRotation), + "dumbbell_overhead_bulgarian_split_squat" => { + Ok(Self::DumbbellOverheadBulgarianSplitSquat) + } + "dumbbell_reverse_lunge_to_high_knee_and_press" => { + Ok(Self::DumbbellReverseLungeToHighKneeAndPress) + } + "dumbbell_side_lunge" => Ok(Self::DumbbellSideLunge), + "elevated_front_foot_barbell_split_squat" => { + Ok(Self::ElevatedFrontFootBarbellSplitSquat) + } + "front_foot_elevated_dumbbell_split_squat" => { + Ok(Self::FrontFootElevatedDumbbellSplitSquat) + } + "gunslinger_lunge" => Ok(Self::GunslingerLunge), + "lawnmower_lunge" => Ok(Self::LawnmowerLunge), + "low_lunge_with_isometric_adduction" => Ok(Self::LowLungeWithIsometricAdduction), + "low_side_to_side_lunge" => Ok(Self::LowSideToSideLunge), + "lunge" => Ok(Self::Lunge), + "weighted_lunge" => Ok(Self::WeightedLunge), + "lunge_with_arm_reach" => Ok(Self::LungeWithArmReach), + "lunge_with_diagonal_reach" => Ok(Self::LungeWithDiagonalReach), + "lunge_with_side_bend" => Ok(Self::LungeWithSideBend), + "offset_dumbbell_lunge" => Ok(Self::OffsetDumbbellLunge), + "offset_dumbbell_reverse_lunge" => Ok(Self::OffsetDumbbellReverseLunge), + "overhead_bulgarian_split_squat" => Ok(Self::OverheadBulgarianSplitSquat), + "overhead_dumbbell_reverse_lunge" => Ok(Self::OverheadDumbbellReverseLunge), + "overhead_dumbbell_split_squat" => Ok(Self::OverheadDumbbellSplitSquat), + "overhead_lunge_with_rotation" => Ok(Self::OverheadLungeWithRotation), + "reverse_barbell_box_lunge" => Ok(Self::ReverseBarbellBoxLunge), + "reverse_box_lunge" => Ok(Self::ReverseBoxLunge), + "reverse_dumbbell_box_lunge" => Ok(Self::ReverseDumbbellBoxLunge), + "reverse_dumbbell_crossover_lunge" => Ok(Self::ReverseDumbbellCrossoverLunge), + "reverse_dumbbell_diagonal_lunge" => Ok(Self::ReverseDumbbellDiagonalLunge), + "reverse_lunge_with_reach_back" => Ok(Self::ReverseLungeWithReachBack), + "weighted_reverse_lunge_with_reach_back" => Ok(Self::WeightedReverseLungeWithReachBack), + "reverse_lunge_with_twist_and_overhead_reach" => { + Ok(Self::ReverseLungeWithTwistAndOverheadReach) + } + "weighted_reverse_lunge_with_twist_and_overhead_reach" => { + Ok(Self::WeightedReverseLungeWithTwistAndOverheadReach) + } + "reverse_sliding_box_lunge" => Ok(Self::ReverseSlidingBoxLunge), + "weighted_reverse_sliding_box_lunge" => Ok(Self::WeightedReverseSlidingBoxLunge), + "reverse_sliding_lunge" => Ok(Self::ReverseSlidingLunge), + "weighted_reverse_sliding_lunge" => Ok(Self::WeightedReverseSlidingLunge), + "runners_lunge_to_balance" => Ok(Self::RunnersLungeToBalance), + "weighted_runners_lunge_to_balance" => Ok(Self::WeightedRunnersLungeToBalance), + "shifting_side_lunge" => Ok(Self::ShiftingSideLunge), + "side_and_crossover_lunge" => Ok(Self::SideAndCrossoverLunge), + "weighted_side_and_crossover_lunge" => Ok(Self::WeightedSideAndCrossoverLunge), + "side_lunge" => Ok(Self::SideLunge), + "weighted_side_lunge" => Ok(Self::WeightedSideLunge), + "side_lunge_and_press" => Ok(Self::SideLungeAndPress), + "side_lunge_jump_off" => Ok(Self::SideLungeJumpOff), + "side_lunge_sweep" => Ok(Self::SideLungeSweep), + "weighted_side_lunge_sweep" => Ok(Self::WeightedSideLungeSweep), + "side_lunge_to_crossover_tap" => Ok(Self::SideLungeToCrossoverTap), + "weighted_side_lunge_to_crossover_tap" => Ok(Self::WeightedSideLungeToCrossoverTap), + "side_to_side_lunge_chops" => Ok(Self::SideToSideLungeChops), + "weighted_side_to_side_lunge_chops" => Ok(Self::WeightedSideToSideLungeChops), + "siff_jump_lunge" => Ok(Self::SiffJumpLunge), + "weighted_siff_jump_lunge" => Ok(Self::WeightedSiffJumpLunge), + "single_arm_reverse_lunge_and_press" => Ok(Self::SingleArmReverseLungeAndPress), + "sliding_lateral_lunge" => Ok(Self::SlidingLateralLunge), + "weighted_sliding_lateral_lunge" => Ok(Self::WeightedSlidingLateralLunge), + "walking_barbell_lunge" => Ok(Self::WalkingBarbellLunge), + "walking_dumbbell_lunge" => Ok(Self::WalkingDumbbellLunge), + "walking_lunge" => Ok(Self::WalkingLunge), + "weighted_walking_lunge" => Ok(Self::WeightedWalkingLunge), + "wide_grip_overhead_barbell_split_squat" => Ok(Self::WideGripOverheadBarbellSplitSquat), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for LungeExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum OlympicLiftExerciseName { BarbellHangPowerClean, @@ -22158,6 +26982,40 @@ impl Serialize for OlympicLiftExerciseName { } } } +impl FromStr for OlympicLiftExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "barbell_hang_power_clean" => Ok(Self::BarbellHangPowerClean), + "barbell_hang_squat_clean" => Ok(Self::BarbellHangSquatClean), + "barbell_power_clean" => Ok(Self::BarbellPowerClean), + "barbell_power_snatch" => Ok(Self::BarbellPowerSnatch), + "barbell_squat_clean" => Ok(Self::BarbellSquatClean), + "clean_and_jerk" => Ok(Self::CleanAndJerk), + "barbell_hang_power_snatch" => Ok(Self::BarbellHangPowerSnatch), + "barbell_hang_pull" => Ok(Self::BarbellHangPull), + "barbell_high_pull" => Ok(Self::BarbellHighPull), + "barbell_snatch" => Ok(Self::BarbellSnatch), + "barbell_split_jerk" => Ok(Self::BarbellSplitJerk), + "clean" => Ok(Self::Clean), + "dumbbell_clean" => Ok(Self::DumbbellClean), + "dumbbell_hang_pull" => Ok(Self::DumbbellHangPull), + "one_hand_dumbbell_split_snatch" => Ok(Self::OneHandDumbbellSplitSnatch), + "push_jerk" => Ok(Self::PushJerk), + "single_arm_dumbbell_snatch" => Ok(Self::SingleArmDumbbellSnatch), + "single_arm_hang_snatch" => Ok(Self::SingleArmHangSnatch), + "single_arm_kettlebell_snatch" => Ok(Self::SingleArmKettlebellSnatch), + "split_jerk" => Ok(Self::SplitJerk), + "squat_clean_and_jerk" => Ok(Self::SquatCleanAndJerk), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for OlympicLiftExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum PlankExerciseName { Name45DegreePlank, @@ -23007,6 +27865,200 @@ impl Serialize for PlankExerciseName { } } } +impl FromStr for PlankExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "45_degree_plank" => Ok(Self::Name45DegreePlank), + "weighted_45_degree_plank" => Ok(Self::Weighted45DegreePlank), + "90_degree_static_hold" => Ok(Self::Name90DegreeStaticHold), + "weighted_90_degree_static_hold" => Ok(Self::Weighted90DegreeStaticHold), + "bear_crawl" => Ok(Self::BearCrawl), + "weighted_bear_crawl" => Ok(Self::WeightedBearCrawl), + "cross_body_mountain_climber" => Ok(Self::CrossBodyMountainClimber), + "weighted_cross_body_mountain_climber" => Ok(Self::WeightedCrossBodyMountainClimber), + "elbow_plank_pike_jacks" => Ok(Self::ElbowPlankPikeJacks), + "weighted_elbow_plank_pike_jacks" => Ok(Self::WeightedElbowPlankPikeJacks), + "elevated_feet_plank" => Ok(Self::ElevatedFeetPlank), + "weighted_elevated_feet_plank" => Ok(Self::WeightedElevatedFeetPlank), + "elevator_abs" => Ok(Self::ElevatorAbs), + "weighted_elevator_abs" => Ok(Self::WeightedElevatorAbs), + "extended_plank" => Ok(Self::ExtendedPlank), + "weighted_extended_plank" => Ok(Self::WeightedExtendedPlank), + "full_plank_passe_twist" => Ok(Self::FullPlankPasseTwist), + "weighted_full_plank_passe_twist" => Ok(Self::WeightedFullPlankPasseTwist), + "inching_elbow_plank" => Ok(Self::InchingElbowPlank), + "weighted_inching_elbow_plank" => Ok(Self::WeightedInchingElbowPlank), + "inchworm_to_side_plank" => Ok(Self::InchwormToSidePlank), + "weighted_inchworm_to_side_plank" => Ok(Self::WeightedInchwormToSidePlank), + "kneeling_plank" => Ok(Self::KneelingPlank), + "weighted_kneeling_plank" => Ok(Self::WeightedKneelingPlank), + "kneeling_side_plank_with_leg_lift" => Ok(Self::KneelingSidePlankWithLegLift), + "weighted_kneeling_side_plank_with_leg_lift" => { + Ok(Self::WeightedKneelingSidePlankWithLegLift) + } + "lateral_roll" => Ok(Self::LateralRoll), + "weighted_lateral_roll" => Ok(Self::WeightedLateralRoll), + "lying_reverse_plank" => Ok(Self::LyingReversePlank), + "weighted_lying_reverse_plank" => Ok(Self::WeightedLyingReversePlank), + "medicine_ball_mountain_climber" => Ok(Self::MedicineBallMountainClimber), + "weighted_medicine_ball_mountain_climber" => { + Ok(Self::WeightedMedicineBallMountainClimber) + } + "modified_mountain_climber_and_extension" => { + Ok(Self::ModifiedMountainClimberAndExtension) + } + "weighted_modified_mountain_climber_and_extension" => { + Ok(Self::WeightedModifiedMountainClimberAndExtension) + } + "mountain_climber" => Ok(Self::MountainClimber), + "weighted_mountain_climber" => Ok(Self::WeightedMountainClimber), + "mountain_climber_on_sliding_discs" => Ok(Self::MountainClimberOnSlidingDiscs), + "weighted_mountain_climber_on_sliding_discs" => { + Ok(Self::WeightedMountainClimberOnSlidingDiscs) + } + "mountain_climber_with_feet_on_bosu_ball" => { + Ok(Self::MountainClimberWithFeetOnBosuBall) + } + "weighted_mountain_climber_with_feet_on_bosu_ball" => { + Ok(Self::WeightedMountainClimberWithFeetOnBosuBall) + } + "mountain_climber_with_hands_on_bench" => Ok(Self::MountainClimberWithHandsOnBench), + "mountain_climber_with_hands_on_swiss_ball" => { + Ok(Self::MountainClimberWithHandsOnSwissBall) + } + "weighted_mountain_climber_with_hands_on_swiss_ball" => { + Ok(Self::WeightedMountainClimberWithHandsOnSwissBall) + } + "plank" => Ok(Self::Plank), + "plank_jacks_with_feet_on_sliding_discs" => Ok(Self::PlankJacksWithFeetOnSlidingDiscs), + "weighted_plank_jacks_with_feet_on_sliding_discs" => { + Ok(Self::WeightedPlankJacksWithFeetOnSlidingDiscs) + } + "plank_knee_twist" => Ok(Self::PlankKneeTwist), + "weighted_plank_knee_twist" => Ok(Self::WeightedPlankKneeTwist), + "plank_pike_jumps" => Ok(Self::PlankPikeJumps), + "weighted_plank_pike_jumps" => Ok(Self::WeightedPlankPikeJumps), + "plank_pikes" => Ok(Self::PlankPikes), + "weighted_plank_pikes" => Ok(Self::WeightedPlankPikes), + "plank_to_stand_up" => Ok(Self::PlankToStandUp), + "weighted_plank_to_stand_up" => Ok(Self::WeightedPlankToStandUp), + "plank_with_arm_raise" => Ok(Self::PlankWithArmRaise), + "weighted_plank_with_arm_raise" => Ok(Self::WeightedPlankWithArmRaise), + "plank_with_knee_to_elbow" => Ok(Self::PlankWithKneeToElbow), + "weighted_plank_with_knee_to_elbow" => Ok(Self::WeightedPlankWithKneeToElbow), + "plank_with_oblique_crunch" => Ok(Self::PlankWithObliqueCrunch), + "weighted_plank_with_oblique_crunch" => Ok(Self::WeightedPlankWithObliqueCrunch), + "plyometric_side_plank" => Ok(Self::PlyometricSidePlank), + "weighted_plyometric_side_plank" => Ok(Self::WeightedPlyometricSidePlank), + "rolling_side_plank" => Ok(Self::RollingSidePlank), + "weighted_rolling_side_plank" => Ok(Self::WeightedRollingSidePlank), + "side_kick_plank" => Ok(Self::SideKickPlank), + "weighted_side_kick_plank" => Ok(Self::WeightedSideKickPlank), + "side_plank" => Ok(Self::SidePlank), + "weighted_side_plank" => Ok(Self::WeightedSidePlank), + "side_plank_and_row" => Ok(Self::SidePlankAndRow), + "weighted_side_plank_and_row" => Ok(Self::WeightedSidePlankAndRow), + "side_plank_lift" => Ok(Self::SidePlankLift), + "weighted_side_plank_lift" => Ok(Self::WeightedSidePlankLift), + "side_plank_with_elbow_on_bosu_ball" => Ok(Self::SidePlankWithElbowOnBosuBall), + "weighted_side_plank_with_elbow_on_bosu_ball" => { + Ok(Self::WeightedSidePlankWithElbowOnBosuBall) + } + "side_plank_with_feet_on_bench" => Ok(Self::SidePlankWithFeetOnBench), + "weighted_side_plank_with_feet_on_bench" => Ok(Self::WeightedSidePlankWithFeetOnBench), + "side_plank_with_knee_circle" => Ok(Self::SidePlankWithKneeCircle), + "weighted_side_plank_with_knee_circle" => Ok(Self::WeightedSidePlankWithKneeCircle), + "side_plank_with_knee_tuck" => Ok(Self::SidePlankWithKneeTuck), + "weighted_side_plank_with_knee_tuck" => Ok(Self::WeightedSidePlankWithKneeTuck), + "side_plank_with_leg_lift" => Ok(Self::SidePlankWithLegLift), + "weighted_side_plank_with_leg_lift" => Ok(Self::WeightedSidePlankWithLegLift), + "side_plank_with_reach_under" => Ok(Self::SidePlankWithReachUnder), + "weighted_side_plank_with_reach_under" => Ok(Self::WeightedSidePlankWithReachUnder), + "single_leg_elevated_feet_plank" => Ok(Self::SingleLegElevatedFeetPlank), + "weighted_single_leg_elevated_feet_plank" => { + Ok(Self::WeightedSingleLegElevatedFeetPlank) + } + "single_leg_flex_and_extend" => Ok(Self::SingleLegFlexAndExtend), + "weighted_single_leg_flex_and_extend" => Ok(Self::WeightedSingleLegFlexAndExtend), + "single_leg_side_plank" => Ok(Self::SingleLegSidePlank), + "weighted_single_leg_side_plank" => Ok(Self::WeightedSingleLegSidePlank), + "spiderman_plank" => Ok(Self::SpidermanPlank), + "weighted_spiderman_plank" => Ok(Self::WeightedSpidermanPlank), + "straight_arm_plank" => Ok(Self::StraightArmPlank), + "weighted_straight_arm_plank" => Ok(Self::WeightedStraightArmPlank), + "straight_arm_plank_with_shoulder_touch" => Ok(Self::StraightArmPlankWithShoulderTouch), + "weighted_straight_arm_plank_with_shoulder_touch" => { + Ok(Self::WeightedStraightArmPlankWithShoulderTouch) + } + "swiss_ball_plank" => Ok(Self::SwissBallPlank), + "weighted_swiss_ball_plank" => Ok(Self::WeightedSwissBallPlank), + "swiss_ball_plank_leg_lift" => Ok(Self::SwissBallPlankLegLift), + "weighted_swiss_ball_plank_leg_lift" => Ok(Self::WeightedSwissBallPlankLegLift), + "swiss_ball_plank_leg_lift_and_hold" => Ok(Self::SwissBallPlankLegLiftAndHold), + "swiss_ball_plank_with_feet_on_bench" => Ok(Self::SwissBallPlankWithFeetOnBench), + "weighted_swiss_ball_plank_with_feet_on_bench" => { + Ok(Self::WeightedSwissBallPlankWithFeetOnBench) + } + "swiss_ball_prone_jackknife" => Ok(Self::SwissBallProneJackknife), + "weighted_swiss_ball_prone_jackknife" => Ok(Self::WeightedSwissBallProneJackknife), + "swiss_ball_side_plank" => Ok(Self::SwissBallSidePlank), + "weighted_swiss_ball_side_plank" => Ok(Self::WeightedSwissBallSidePlank), + "three_way_plank" => Ok(Self::ThreeWayPlank), + "weighted_three_way_plank" => Ok(Self::WeightedThreeWayPlank), + "towel_plank_and_knee_in" => Ok(Self::TowelPlankAndKneeIn), + "weighted_towel_plank_and_knee_in" => Ok(Self::WeightedTowelPlankAndKneeIn), + "t_stabilization" => Ok(Self::TStabilization), + "weighted_t_stabilization" => Ok(Self::WeightedTStabilization), + "turkish_get_up_to_side_plank" => Ok(Self::TurkishGetUpToSidePlank), + "weighted_turkish_get_up_to_side_plank" => Ok(Self::WeightedTurkishGetUpToSidePlank), + "two_point_plank" => Ok(Self::TwoPointPlank), + "weighted_two_point_plank" => Ok(Self::WeightedTwoPointPlank), + "weighted_plank" => Ok(Self::WeightedPlank), + "wide_stance_plank_with_diagonal_arm_lift" => { + Ok(Self::WideStancePlankWithDiagonalArmLift) + } + "weighted_wide_stance_plank_with_diagonal_arm_lift" => { + Ok(Self::WeightedWideStancePlankWithDiagonalArmLift) + } + "wide_stance_plank_with_diagonal_leg_lift" => { + Ok(Self::WideStancePlankWithDiagonalLegLift) + } + "weighted_wide_stance_plank_with_diagonal_leg_lift" => { + Ok(Self::WeightedWideStancePlankWithDiagonalLegLift) + } + "wide_stance_plank_with_leg_lift" => Ok(Self::WideStancePlankWithLegLift), + "weighted_wide_stance_plank_with_leg_lift" => { + Ok(Self::WeightedWideStancePlankWithLegLift) + } + "wide_stance_plank_with_opposite_arm_and_leg_lift" => { + Ok(Self::WideStancePlankWithOppositeArmAndLegLift) + } + "weighted_mountain_climber_with_hands_on_bench" => { + Ok(Self::WeightedMountainClimberWithHandsOnBench) + } + "weighted_swiss_ball_plank_leg_lift_and_hold" => { + Ok(Self::WeightedSwissBallPlankLegLiftAndHold) + } + "weighted_wide_stance_plank_with_opposite_arm_and_leg_lift" => { + Ok(Self::WeightedWideStancePlankWithOppositeArmAndLegLift) + } + "plank_with_feet_on_swiss_ball" => Ok(Self::PlankWithFeetOnSwissBall), + "side_plank_to_plank_with_reach_under" => Ok(Self::SidePlankToPlankWithReachUnder), + "bridge_with_glute_lower_lift" => Ok(Self::BridgeWithGluteLowerLift), + "bridge_one_leg_bridge" => Ok(Self::BridgeOneLegBridge), + "plank_with_arm_variations" => Ok(Self::PlankWithArmVariations), + "plank_with_leg_lift" => Ok(Self::PlankWithLegLift), + "reverse_plank_with_leg_pull" => Ok(Self::ReversePlankWithLegPull), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for PlankExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum PlyoExerciseName { AlternatingJumpLunge, @@ -23239,6 +28291,56 @@ impl Serialize for PlyoExerciseName { } } } +impl FromStr for PlyoExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "alternating_jump_lunge" => Ok(Self::AlternatingJumpLunge), + "weighted_alternating_jump_lunge" => Ok(Self::WeightedAlternatingJumpLunge), + "barbell_jump_squat" => Ok(Self::BarbellJumpSquat), + "body_weight_jump_squat" => Ok(Self::BodyWeightJumpSquat), + "weighted_jump_squat" => Ok(Self::WeightedJumpSquat), + "cross_knee_strike" => Ok(Self::CrossKneeStrike), + "weighted_cross_knee_strike" => Ok(Self::WeightedCrossKneeStrike), + "depth_jump" => Ok(Self::DepthJump), + "weighted_depth_jump" => Ok(Self::WeightedDepthJump), + "dumbbell_jump_squat" => Ok(Self::DumbbellJumpSquat), + "dumbbell_split_jump" => Ok(Self::DumbbellSplitJump), + "front_knee_strike" => Ok(Self::FrontKneeStrike), + "weighted_front_knee_strike" => Ok(Self::WeightedFrontKneeStrike), + "high_box_jump" => Ok(Self::HighBoxJump), + "weighted_high_box_jump" => Ok(Self::WeightedHighBoxJump), + "isometric_explosive_body_weight_jump_squat" => { + Ok(Self::IsometricExplosiveBodyWeightJumpSquat) + } + "weighted_isometric_explosive_jump_squat" => { + Ok(Self::WeightedIsometricExplosiveJumpSquat) + } + "lateral_leap_and_hop" => Ok(Self::LateralLeapAndHop), + "weighted_lateral_leap_and_hop" => Ok(Self::WeightedLateralLeapAndHop), + "lateral_plyo_squats" => Ok(Self::LateralPlyoSquats), + "weighted_lateral_plyo_squats" => Ok(Self::WeightedLateralPlyoSquats), + "lateral_slide" => Ok(Self::LateralSlide), + "weighted_lateral_slide" => Ok(Self::WeightedLateralSlide), + "medicine_ball_overhead_throws" => Ok(Self::MedicineBallOverheadThrows), + "medicine_ball_side_throw" => Ok(Self::MedicineBallSideThrow), + "medicine_ball_slam" => Ok(Self::MedicineBallSlam), + "side_to_side_medicine_ball_throws" => Ok(Self::SideToSideMedicineBallThrows), + "side_to_side_shuffle_jump" => Ok(Self::SideToSideShuffleJump), + "weighted_side_to_side_shuffle_jump" => Ok(Self::WeightedSideToSideShuffleJump), + "squat_jump_onto_box" => Ok(Self::SquatJumpOntoBox), + "weighted_squat_jump_onto_box" => Ok(Self::WeightedSquatJumpOntoBox), + "squat_jumps_in_and_out" => Ok(Self::SquatJumpsInAndOut), + "weighted_squat_jumps_in_and_out" => Ok(Self::WeightedSquatJumpsInAndOut), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for PlyoExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum PullUpExerciseName { BandedPullUps, @@ -23485,6 +28587,58 @@ impl Serialize for PullUpExerciseName { } } } +impl FromStr for PullUpExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "banded_pull_ups" => Ok(Self::BandedPullUps), + "30_degree_lat_pulldown" => Ok(Self::Name30DegreeLatPulldown), + "band_assisted_chin_up" => Ok(Self::BandAssistedChinUp), + "close_grip_chin_up" => Ok(Self::CloseGripChinUp), + "weighted_close_grip_chin_up" => Ok(Self::WeightedCloseGripChinUp), + "close_grip_lat_pulldown" => Ok(Self::CloseGripLatPulldown), + "crossover_chin_up" => Ok(Self::CrossoverChinUp), + "weighted_crossover_chin_up" => Ok(Self::WeightedCrossoverChinUp), + "ez_bar_pullover" => Ok(Self::EzBarPullover), + "hanging_hurdle" => Ok(Self::HangingHurdle), + "weighted_hanging_hurdle" => Ok(Self::WeightedHangingHurdle), + "kneeling_lat_pulldown" => Ok(Self::KneelingLatPulldown), + "kneeling_underhand_grip_lat_pulldown" => Ok(Self::KneelingUnderhandGripLatPulldown), + "lat_pulldown" => Ok(Self::LatPulldown), + "mixed_grip_chin_up" => Ok(Self::MixedGripChinUp), + "weighted_mixed_grip_chin_up" => Ok(Self::WeightedMixedGripChinUp), + "mixed_grip_pull_up" => Ok(Self::MixedGripPullUp), + "weighted_mixed_grip_pull_up" => Ok(Self::WeightedMixedGripPullUp), + "reverse_grip_pulldown" => Ok(Self::ReverseGripPulldown), + "standing_cable_pullover" => Ok(Self::StandingCablePullover), + "straight_arm_pulldown" => Ok(Self::StraightArmPulldown), + "swiss_ball_ez_bar_pullover" => Ok(Self::SwissBallEzBarPullover), + "towel_pull_up" => Ok(Self::TowelPullUp), + "weighted_towel_pull_up" => Ok(Self::WeightedTowelPullUp), + "weighted_pull_up" => Ok(Self::WeightedPullUp), + "wide_grip_lat_pulldown" => Ok(Self::WideGripLatPulldown), + "wide_grip_pull_up" => Ok(Self::WideGripPullUp), + "weighted_wide_grip_pull_up" => Ok(Self::WeightedWideGripPullUp), + "burpee_pull_up" => Ok(Self::BurpeePullUp), + "weighted_burpee_pull_up" => Ok(Self::WeightedBurpeePullUp), + "jumping_pull_ups" => Ok(Self::JumpingPullUps), + "weighted_jumping_pull_ups" => Ok(Self::WeightedJumpingPullUps), + "kipping_pull_up" => Ok(Self::KippingPullUp), + "weighted_kipping_pull_up" => Ok(Self::WeightedKippingPullUp), + "l_pull_up" => Ok(Self::LPullUp), + "weighted_l_pull_up" => Ok(Self::WeightedLPullUp), + "suspended_chin_up" => Ok(Self::SuspendedChinUp), + "weighted_suspended_chin_up" => Ok(Self::WeightedSuspendedChinUp), + "pull_up" => Ok(Self::PullUp), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for PullUpExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum PushUpExerciseName { ChestPressWithBand, @@ -23985,6 +29139,114 @@ impl Serialize for PushUpExerciseName { } } } +impl FromStr for PushUpExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "chest_press_with_band" => Ok(Self::ChestPressWithBand), + "alternating_staggered_push_up" => Ok(Self::AlternatingStaggeredPushUp), + "weighted_alternating_staggered_push_up" => { + Ok(Self::WeightedAlternatingStaggeredPushUp) + } + "alternating_hands_medicine_ball_push_up" => { + Ok(Self::AlternatingHandsMedicineBallPushUp) + } + "weighted_alternating_hands_medicine_ball_push_up" => { + Ok(Self::WeightedAlternatingHandsMedicineBallPushUp) + } + "bosu_ball_push_up" => Ok(Self::BosuBallPushUp), + "weighted_bosu_ball_push_up" => Ok(Self::WeightedBosuBallPushUp), + "clapping_push_up" => Ok(Self::ClappingPushUp), + "weighted_clapping_push_up" => Ok(Self::WeightedClappingPushUp), + "close_grip_medicine_ball_push_up" => Ok(Self::CloseGripMedicineBallPushUp), + "weighted_close_grip_medicine_ball_push_up" => { + Ok(Self::WeightedCloseGripMedicineBallPushUp) + } + "close_hands_push_up" => Ok(Self::CloseHandsPushUp), + "weighted_close_hands_push_up" => Ok(Self::WeightedCloseHandsPushUp), + "decline_push_up" => Ok(Self::DeclinePushUp), + "weighted_decline_push_up" => Ok(Self::WeightedDeclinePushUp), + "diamond_push_up" => Ok(Self::DiamondPushUp), + "weighted_diamond_push_up" => Ok(Self::WeightedDiamondPushUp), + "explosive_crossover_push_up" => Ok(Self::ExplosiveCrossoverPushUp), + "weighted_explosive_crossover_push_up" => Ok(Self::WeightedExplosiveCrossoverPushUp), + "explosive_push_up" => Ok(Self::ExplosivePushUp), + "weighted_explosive_push_up" => Ok(Self::WeightedExplosivePushUp), + "feet_elevated_side_to_side_push_up" => Ok(Self::FeetElevatedSideToSidePushUp), + "weighted_feet_elevated_side_to_side_push_up" => { + Ok(Self::WeightedFeetElevatedSideToSidePushUp) + } + "hand_release_push_up" => Ok(Self::HandReleasePushUp), + "weighted_hand_release_push_up" => Ok(Self::WeightedHandReleasePushUp), + "handstand_push_up" => Ok(Self::HandstandPushUp), + "weighted_handstand_push_up" => Ok(Self::WeightedHandstandPushUp), + "incline_push_up" => Ok(Self::InclinePushUp), + "weighted_incline_push_up" => Ok(Self::WeightedInclinePushUp), + "isometric_explosive_push_up" => Ok(Self::IsometricExplosivePushUp), + "weighted_isometric_explosive_push_up" => Ok(Self::WeightedIsometricExplosivePushUp), + "judo_push_up" => Ok(Self::JudoPushUp), + "weighted_judo_push_up" => Ok(Self::WeightedJudoPushUp), + "kneeling_push_up" => Ok(Self::KneelingPushUp), + "weighted_kneeling_push_up" => Ok(Self::WeightedKneelingPushUp), + "medicine_ball_chest_pass" => Ok(Self::MedicineBallChestPass), + "medicine_ball_push_up" => Ok(Self::MedicineBallPushUp), + "weighted_medicine_ball_push_up" => Ok(Self::WeightedMedicineBallPushUp), + "one_arm_push_up" => Ok(Self::OneArmPushUp), + "weighted_one_arm_push_up" => Ok(Self::WeightedOneArmPushUp), + "weighted_push_up" => Ok(Self::WeightedPushUp), + "push_up_and_row" => Ok(Self::PushUpAndRow), + "weighted_push_up_and_row" => Ok(Self::WeightedPushUpAndRow), + "push_up_plus" => Ok(Self::PushUpPlus), + "weighted_push_up_plus" => Ok(Self::WeightedPushUpPlus), + "push_up_with_feet_on_swiss_ball" => Ok(Self::PushUpWithFeetOnSwissBall), + "weighted_push_up_with_feet_on_swiss_ball" => { + Ok(Self::WeightedPushUpWithFeetOnSwissBall) + } + "push_up_with_one_hand_on_medicine_ball" => Ok(Self::PushUpWithOneHandOnMedicineBall), + "weighted_push_up_with_one_hand_on_medicine_ball" => { + Ok(Self::WeightedPushUpWithOneHandOnMedicineBall) + } + "shoulder_push_up" => Ok(Self::ShoulderPushUp), + "weighted_shoulder_push_up" => Ok(Self::WeightedShoulderPushUp), + "single_arm_medicine_ball_push_up" => Ok(Self::SingleArmMedicineBallPushUp), + "weighted_single_arm_medicine_ball_push_up" => { + Ok(Self::WeightedSingleArmMedicineBallPushUp) + } + "spiderman_push_up" => Ok(Self::SpidermanPushUp), + "weighted_spiderman_push_up" => Ok(Self::WeightedSpidermanPushUp), + "stacked_feet_push_up" => Ok(Self::StackedFeetPushUp), + "weighted_stacked_feet_push_up" => Ok(Self::WeightedStackedFeetPushUp), + "staggered_hands_push_up" => Ok(Self::StaggeredHandsPushUp), + "weighted_staggered_hands_push_up" => Ok(Self::WeightedStaggeredHandsPushUp), + "suspended_push_up" => Ok(Self::SuspendedPushUp), + "weighted_suspended_push_up" => Ok(Self::WeightedSuspendedPushUp), + "swiss_ball_push_up" => Ok(Self::SwissBallPushUp), + "weighted_swiss_ball_push_up" => Ok(Self::WeightedSwissBallPushUp), + "swiss_ball_push_up_plus" => Ok(Self::SwissBallPushUpPlus), + "weighted_swiss_ball_push_up_plus" => Ok(Self::WeightedSwissBallPushUpPlus), + "t_push_up" => Ok(Self::TPushUp), + "weighted_t_push_up" => Ok(Self::WeightedTPushUp), + "triple_stop_push_up" => Ok(Self::TripleStopPushUp), + "weighted_triple_stop_push_up" => Ok(Self::WeightedTripleStopPushUp), + "wide_hands_push_up" => Ok(Self::WideHandsPushUp), + "weighted_wide_hands_push_up" => Ok(Self::WeightedWideHandsPushUp), + "parallette_handstand_push_up" => Ok(Self::ParalletteHandstandPushUp), + "weighted_parallette_handstand_push_up" => Ok(Self::WeightedParalletteHandstandPushUp), + "ring_handstand_push_up" => Ok(Self::RingHandstandPushUp), + "weighted_ring_handstand_push_up" => Ok(Self::WeightedRingHandstandPushUp), + "ring_push_up" => Ok(Self::RingPushUp), + "weighted_ring_push_up" => Ok(Self::WeightedRingPushUp), + "push_up" => Ok(Self::PushUp), + "pilates_pushup" => Ok(Self::PilatesPushup), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for PushUpExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum RowExerciseName { BarbellStraightLegDeadliftToRow, @@ -24230,6 +29492,57 @@ impl Serialize for RowExerciseName { } } } +impl FromStr for RowExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "barbell_straight_leg_deadlift_to_row" => Ok(Self::BarbellStraightLegDeadliftToRow), + "cable_row_standing" => Ok(Self::CableRowStanding), + "dumbbell_row" => Ok(Self::DumbbellRow), + "elevated_feet_inverted_row" => Ok(Self::ElevatedFeetInvertedRow), + "weighted_elevated_feet_inverted_row" => Ok(Self::WeightedElevatedFeetInvertedRow), + "face_pull" => Ok(Self::FacePull), + "face_pull_with_external_rotation" => Ok(Self::FacePullWithExternalRotation), + "inverted_row_with_feet_on_swiss_ball" => Ok(Self::InvertedRowWithFeetOnSwissBall), + "weighted_inverted_row_with_feet_on_swiss_ball" => { + Ok(Self::WeightedInvertedRowWithFeetOnSwissBall) + } + "kettlebell_row" => Ok(Self::KettlebellRow), + "modified_inverted_row" => Ok(Self::ModifiedInvertedRow), + "weighted_modified_inverted_row" => Ok(Self::WeightedModifiedInvertedRow), + "neutral_grip_alternating_dumbbell_row" => Ok(Self::NeutralGripAlternatingDumbbellRow), + "one_arm_bent_over_row" => Ok(Self::OneArmBentOverRow), + "one_legged_dumbbell_row" => Ok(Self::OneLeggedDumbbellRow), + "renegade_row" => Ok(Self::RenegadeRow), + "reverse_grip_barbell_row" => Ok(Self::ReverseGripBarbellRow), + "rope_handle_cable_row" => Ok(Self::RopeHandleCableRow), + "seated_cable_row" => Ok(Self::SeatedCableRow), + "seated_dumbbell_row" => Ok(Self::SeatedDumbbellRow), + "single_arm_cable_row" => Ok(Self::SingleArmCableRow), + "single_arm_cable_row_and_rotation" => Ok(Self::SingleArmCableRowAndRotation), + "single_arm_inverted_row" => Ok(Self::SingleArmInvertedRow), + "weighted_single_arm_inverted_row" => Ok(Self::WeightedSingleArmInvertedRow), + "single_arm_neutral_grip_dumbbell_row" => Ok(Self::SingleArmNeutralGripDumbbellRow), + "single_arm_neutral_grip_dumbbell_row_and_rotation" => { + Ok(Self::SingleArmNeutralGripDumbbellRowAndRotation) + } + "suspended_inverted_row" => Ok(Self::SuspendedInvertedRow), + "weighted_suspended_inverted_row" => Ok(Self::WeightedSuspendedInvertedRow), + "t_bar_row" => Ok(Self::TBarRow), + "towel_grip_inverted_row" => Ok(Self::TowelGripInvertedRow), + "weighted_towel_grip_inverted_row" => Ok(Self::WeightedTowelGripInvertedRow), + "underhand_grip_cable_row" => Ok(Self::UnderhandGripCableRow), + "v_grip_cable_row" => Ok(Self::VGripCableRow), + "wide_grip_seated_cable_row" => Ok(Self::WideGripSeatedCableRow), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for RowExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ShoulderPressExerciseName { AlternatingDumbbellShoulderPress, @@ -24433,6 +29746,47 @@ impl Serialize for ShoulderPressExerciseName { } } } +impl FromStr for ShoulderPressExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "alternating_dumbbell_shoulder_press" => Ok(Self::AlternatingDumbbellShoulderPress), + "arnold_press" => Ok(Self::ArnoldPress), + "barbell_front_squat_to_push_press" => Ok(Self::BarbellFrontSquatToPushPress), + "barbell_push_press" => Ok(Self::BarbellPushPress), + "barbell_shoulder_press" => Ok(Self::BarbellShoulderPress), + "dead_curl_press" => Ok(Self::DeadCurlPress), + "dumbbell_alternating_shoulder_press_and_twist" => { + Ok(Self::DumbbellAlternatingShoulderPressAndTwist) + } + "dumbbell_hammer_curl_to_lunge_to_press" => Ok(Self::DumbbellHammerCurlToLungeToPress), + "dumbbell_push_press" => Ok(Self::DumbbellPushPress), + "floor_inverted_shoulder_press" => Ok(Self::FloorInvertedShoulderPress), + "weighted_floor_inverted_shoulder_press" => { + Ok(Self::WeightedFloorInvertedShoulderPress) + } + "inverted_shoulder_press" => Ok(Self::InvertedShoulderPress), + "weighted_inverted_shoulder_press" => Ok(Self::WeightedInvertedShoulderPress), + "one_arm_push_press" => Ok(Self::OneArmPushPress), + "overhead_barbell_press" => Ok(Self::OverheadBarbellPress), + "overhead_dumbbell_press" => Ok(Self::OverheadDumbbellPress), + "seated_barbell_shoulder_press" => Ok(Self::SeatedBarbellShoulderPress), + "seated_dumbbell_shoulder_press" => Ok(Self::SeatedDumbbellShoulderPress), + "single_arm_dumbbell_shoulder_press" => Ok(Self::SingleArmDumbbellShoulderPress), + "single_arm_step_up_and_press" => Ok(Self::SingleArmStepUpAndPress), + "smith_machine_overhead_press" => Ok(Self::SmithMachineOverheadPress), + "split_stance_hammer_curl_to_press" => Ok(Self::SplitStanceHammerCurlToPress), + "swiss_ball_dumbbell_shoulder_press" => Ok(Self::SwissBallDumbbellShoulderPress), + "weight_plate_front_raise" => Ok(Self::WeightPlateFrontRaise), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ShoulderPressExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ShoulderStabilityExerciseName { Name90DegreeCableExternalRotation, @@ -24687,6 +30041,56 @@ impl Serialize for ShoulderStabilityExerciseName { } } } +impl FromStr for ShoulderStabilityExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "90_degree_cable_external_rotation" => Ok(Self::Name90DegreeCableExternalRotation), + "band_external_rotation" => Ok(Self::BandExternalRotation), + "band_internal_rotation" => Ok(Self::BandInternalRotation), + "bent_arm_lateral_raise_and_external_rotation" => { + Ok(Self::BentArmLateralRaiseAndExternalRotation) + } + "cable_external_rotation" => Ok(Self::CableExternalRotation), + "dumbbell_face_pull_with_external_rotation" => { + Ok(Self::DumbbellFacePullWithExternalRotation) + } + "floor_i_raise" => Ok(Self::FloorIRaise), + "weighted_floor_i_raise" => Ok(Self::WeightedFloorIRaise), + "floor_t_raise" => Ok(Self::FloorTRaise), + "weighted_floor_t_raise" => Ok(Self::WeightedFloorTRaise), + "floor_y_raise" => Ok(Self::FloorYRaise), + "weighted_floor_y_raise" => Ok(Self::WeightedFloorYRaise), + "incline_i_raise" => Ok(Self::InclineIRaise), + "weighted_incline_i_raise" => Ok(Self::WeightedInclineIRaise), + "incline_l_raise" => Ok(Self::InclineLRaise), + "weighted_incline_l_raise" => Ok(Self::WeightedInclineLRaise), + "incline_t_raise" => Ok(Self::InclineTRaise), + "weighted_incline_t_raise" => Ok(Self::WeightedInclineTRaise), + "incline_w_raise" => Ok(Self::InclineWRaise), + "weighted_incline_w_raise" => Ok(Self::WeightedInclineWRaise), + "incline_y_raise" => Ok(Self::InclineYRaise), + "weighted_incline_y_raise" => Ok(Self::WeightedInclineYRaise), + "lying_external_rotation" => Ok(Self::LyingExternalRotation), + "seated_dumbbell_external_rotation" => Ok(Self::SeatedDumbbellExternalRotation), + "standing_l_raise" => Ok(Self::StandingLRaise), + "swiss_ball_i_raise" => Ok(Self::SwissBallIRaise), + "weighted_swiss_ball_i_raise" => Ok(Self::WeightedSwissBallIRaise), + "swiss_ball_t_raise" => Ok(Self::SwissBallTRaise), + "weighted_swiss_ball_t_raise" => Ok(Self::WeightedSwissBallTRaise), + "swiss_ball_w_raise" => Ok(Self::SwissBallWRaise), + "weighted_swiss_ball_w_raise" => Ok(Self::WeightedSwissBallWRaise), + "swiss_ball_y_raise" => Ok(Self::SwissBallYRaise), + "weighted_swiss_ball_y_raise" => Ok(Self::WeightedSwissBallYRaise), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ShoulderStabilityExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ShrugExerciseName { BarbellJumpShrug, @@ -24825,6 +30229,36 @@ impl Serialize for ShrugExerciseName { } } } +impl FromStr for ShrugExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "barbell_jump_shrug" => Ok(Self::BarbellJumpShrug), + "barbell_shrug" => Ok(Self::BarbellShrug), + "barbell_upright_row" => Ok(Self::BarbellUprightRow), + "behind_the_back_smith_machine_shrug" => Ok(Self::BehindTheBackSmithMachineShrug), + "dumbbell_jump_shrug" => Ok(Self::DumbbellJumpShrug), + "dumbbell_shrug" => Ok(Self::DumbbellShrug), + "dumbbell_upright_row" => Ok(Self::DumbbellUprightRow), + "incline_dumbbell_shrug" => Ok(Self::InclineDumbbellShrug), + "overhead_barbell_shrug" => Ok(Self::OverheadBarbellShrug), + "overhead_dumbbell_shrug" => Ok(Self::OverheadDumbbellShrug), + "scaption_and_shrug" => Ok(Self::ScaptionAndShrug), + "scapular_retraction" => Ok(Self::ScapularRetraction), + "serratus_chair_shrug" => Ok(Self::SerratusChairShrug), + "weighted_serratus_chair_shrug" => Ok(Self::WeightedSerratusChairShrug), + "serratus_shrug" => Ok(Self::SerratusShrug), + "weighted_serratus_shrug" => Ok(Self::WeightedSerratusShrug), + "wide_grip_jump_shrug" => Ok(Self::WideGripJumpShrug), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ShrugExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SitUpExerciseName { AlternatingSitUp, @@ -25078,6 +30512,59 @@ impl Serialize for SitUpExerciseName { } } } +impl FromStr for SitUpExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "alternating_sit_up" => Ok(Self::AlternatingSitUp), + "weighted_alternating_sit_up" => Ok(Self::WeightedAlternatingSitUp), + "bent_knee_v_up" => Ok(Self::BentKneeVUp), + "weighted_bent_knee_v_up" => Ok(Self::WeightedBentKneeVUp), + "butterfly_sit_up" => Ok(Self::ButterflySitUp), + "weighted_butterfly_situp" => Ok(Self::WeightedButterflySitup), + "cross_punch_roll_up" => Ok(Self::CrossPunchRollUp), + "weighted_cross_punch_roll_up" => Ok(Self::WeightedCrossPunchRollUp), + "crossed_arms_sit_up" => Ok(Self::CrossedArmsSitUp), + "weighted_crossed_arms_sit_up" => Ok(Self::WeightedCrossedArmsSitUp), + "get_up_sit_up" => Ok(Self::GetUpSitUp), + "weighted_get_up_sit_up" => Ok(Self::WeightedGetUpSitUp), + "hovering_sit_up" => Ok(Self::HoveringSitUp), + "weighted_hovering_sit_up" => Ok(Self::WeightedHoveringSitUp), + "kettlebell_sit_up" => Ok(Self::KettlebellSitUp), + "medicine_ball_alternating_v_up" => Ok(Self::MedicineBallAlternatingVUp), + "medicine_ball_sit_up" => Ok(Self::MedicineBallSitUp), + "medicine_ball_v_up" => Ok(Self::MedicineBallVUp), + "modified_sit_up" => Ok(Self::ModifiedSitUp), + "negative_sit_up" => Ok(Self::NegativeSitUp), + "one_arm_full_sit_up" => Ok(Self::OneArmFullSitUp), + "reclining_circle" => Ok(Self::RecliningCircle), + "weighted_reclining_circle" => Ok(Self::WeightedRecliningCircle), + "reverse_curl_up" => Ok(Self::ReverseCurlUp), + "weighted_reverse_curl_up" => Ok(Self::WeightedReverseCurlUp), + "single_leg_swiss_ball_jackknife" => Ok(Self::SingleLegSwissBallJackknife), + "weighted_single_leg_swiss_ball_jackknife" => { + Ok(Self::WeightedSingleLegSwissBallJackknife) + } + "the_teaser" => Ok(Self::TheTeaser), + "the_teaser_weighted" => Ok(Self::TheTeaserWeighted), + "three_part_roll_down" => Ok(Self::ThreePartRollDown), + "weighted_three_part_roll_down" => Ok(Self::WeightedThreePartRollDown), + "v_up" => Ok(Self::VUp), + "weighted_v_up" => Ok(Self::WeightedVUp), + "weighted_russian_twist_on_swiss_ball" => Ok(Self::WeightedRussianTwistOnSwissBall), + "weighted_sit_up" => Ok(Self::WeightedSitUp), + "x_abs" => Ok(Self::XAbs), + "weighted_x_abs" => Ok(Self::WeightedXAbs), + "sit_up" => Ok(Self::SitUp), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SitUpExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SquatExerciseName { LegPress, @@ -25625,6 +31112,119 @@ impl Serialize for SquatExerciseName { } } } +impl FromStr for SquatExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "leg_press" => Ok(Self::LegPress), + "back_squat_with_body_bar" => Ok(Self::BackSquatWithBodyBar), + "back_squats" => Ok(Self::BackSquats), + "weighted_back_squats" => Ok(Self::WeightedBackSquats), + "balancing_squat" => Ok(Self::BalancingSquat), + "weighted_balancing_squat" => Ok(Self::WeightedBalancingSquat), + "barbell_back_squat" => Ok(Self::BarbellBackSquat), + "barbell_box_squat" => Ok(Self::BarbellBoxSquat), + "barbell_front_squat" => Ok(Self::BarbellFrontSquat), + "barbell_hack_squat" => Ok(Self::BarbellHackSquat), + "barbell_hang_squat_snatch" => Ok(Self::BarbellHangSquatSnatch), + "barbell_lateral_step_up" => Ok(Self::BarbellLateralStepUp), + "barbell_quarter_squat" => Ok(Self::BarbellQuarterSquat), + "barbell_siff_squat" => Ok(Self::BarbellSiffSquat), + "barbell_squat_snatch" => Ok(Self::BarbellSquatSnatch), + "barbell_squat_with_heels_raised" => Ok(Self::BarbellSquatWithHeelsRaised), + "barbell_stepover" => Ok(Self::BarbellStepover), + "barbell_step_up" => Ok(Self::BarbellStepUp), + "bench_squat_with_rotational_chop" => Ok(Self::BenchSquatWithRotationalChop), + "weighted_bench_squat_with_rotational_chop" => { + Ok(Self::WeightedBenchSquatWithRotationalChop) + } + "body_weight_wall_squat" => Ok(Self::BodyWeightWallSquat), + "weighted_wall_squat" => Ok(Self::WeightedWallSquat), + "box_step_squat" => Ok(Self::BoxStepSquat), + "weighted_box_step_squat" => Ok(Self::WeightedBoxStepSquat), + "braced_squat" => Ok(Self::BracedSquat), + "crossed_arm_barbell_front_squat" => Ok(Self::CrossedArmBarbellFrontSquat), + "crossover_dumbbell_step_up" => Ok(Self::CrossoverDumbbellStepUp), + "dumbbell_front_squat" => Ok(Self::DumbbellFrontSquat), + "dumbbell_split_squat" => Ok(Self::DumbbellSplitSquat), + "dumbbell_squat" => Ok(Self::DumbbellSquat), + "dumbbell_squat_clean" => Ok(Self::DumbbellSquatClean), + "dumbbell_stepover" => Ok(Self::DumbbellStepover), + "dumbbell_step_up" => Ok(Self::DumbbellStepUp), + "elevated_single_leg_squat" => Ok(Self::ElevatedSingleLegSquat), + "weighted_elevated_single_leg_squat" => Ok(Self::WeightedElevatedSingleLegSquat), + "figure_four_squats" => Ok(Self::FigureFourSquats), + "weighted_figure_four_squats" => Ok(Self::WeightedFigureFourSquats), + "goblet_squat" => Ok(Self::GobletSquat), + "kettlebell_squat" => Ok(Self::KettlebellSquat), + "kettlebell_swing_overhead" => Ok(Self::KettlebellSwingOverhead), + "kettlebell_swing_with_flip_to_squat" => Ok(Self::KettlebellSwingWithFlipToSquat), + "lateral_dumbbell_step_up" => Ok(Self::LateralDumbbellStepUp), + "one_legged_squat" => Ok(Self::OneLeggedSquat), + "overhead_dumbbell_squat" => Ok(Self::OverheadDumbbellSquat), + "overhead_squat" => Ok(Self::OverheadSquat), + "partial_single_leg_squat" => Ok(Self::PartialSingleLegSquat), + "weighted_partial_single_leg_squat" => Ok(Self::WeightedPartialSingleLegSquat), + "pistol_squat" => Ok(Self::PistolSquat), + "weighted_pistol_squat" => Ok(Self::WeightedPistolSquat), + "plie_slides" => Ok(Self::PlieSlides), + "weighted_plie_slides" => Ok(Self::WeightedPlieSlides), + "plie_squat" => Ok(Self::PlieSquat), + "weighted_plie_squat" => Ok(Self::WeightedPlieSquat), + "prisoner_squat" => Ok(Self::PrisonerSquat), + "weighted_prisoner_squat" => Ok(Self::WeightedPrisonerSquat), + "single_leg_bench_get_up" => Ok(Self::SingleLegBenchGetUp), + "weighted_single_leg_bench_get_up" => Ok(Self::WeightedSingleLegBenchGetUp), + "single_leg_bench_squat" => Ok(Self::SingleLegBenchSquat), + "weighted_single_leg_bench_squat" => Ok(Self::WeightedSingleLegBenchSquat), + "single_leg_squat_on_swiss_ball" => Ok(Self::SingleLegSquatOnSwissBall), + "weighted_single_leg_squat_on_swiss_ball" => { + Ok(Self::WeightedSingleLegSquatOnSwissBall) + } + "squat" => Ok(Self::Squat), + "weighted_squat" => Ok(Self::WeightedSquat), + "squats_with_band" => Ok(Self::SquatsWithBand), + "staggered_squat" => Ok(Self::StaggeredSquat), + "weighted_staggered_squat" => Ok(Self::WeightedStaggeredSquat), + "step_up" => Ok(Self::StepUp), + "weighted_step_up" => Ok(Self::WeightedStepUp), + "suitcase_squats" => Ok(Self::SuitcaseSquats), + "sumo_squat" => Ok(Self::SumoSquat), + "sumo_squat_slide_in" => Ok(Self::SumoSquatSlideIn), + "weighted_sumo_squat_slide_in" => Ok(Self::WeightedSumoSquatSlideIn), + "sumo_squat_to_high_pull" => Ok(Self::SumoSquatToHighPull), + "sumo_squat_to_stand" => Ok(Self::SumoSquatToStand), + "weighted_sumo_squat_to_stand" => Ok(Self::WeightedSumoSquatToStand), + "sumo_squat_with_rotation" => Ok(Self::SumoSquatWithRotation), + "weighted_sumo_squat_with_rotation" => Ok(Self::WeightedSumoSquatWithRotation), + "swiss_ball_body_weight_wall_squat" => Ok(Self::SwissBallBodyWeightWallSquat), + "weighted_swiss_ball_wall_squat" => Ok(Self::WeightedSwissBallWallSquat), + "thrusters" => Ok(Self::Thrusters), + "uneven_squat" => Ok(Self::UnevenSquat), + "weighted_uneven_squat" => Ok(Self::WeightedUnevenSquat), + "waist_slimming_squat" => Ok(Self::WaistSlimmingSquat), + "wall_ball" => Ok(Self::WallBall), + "wide_stance_barbell_squat" => Ok(Self::WideStanceBarbellSquat), + "wide_stance_goblet_squat" => Ok(Self::WideStanceGobletSquat), + "zercher_squat" => Ok(Self::ZercherSquat), + "kbs_overhead" => Ok(Self::KbsOverhead), + "squat_and_side_kick" => Ok(Self::SquatAndSideKick), + "squat_jumps_in_n_out" => Ok(Self::SquatJumpsInNOut), + "pilates_plie_squats_parallel_turned_out_flat_and_heels" => { + Ok(Self::PilatesPlieSquatsParallelTurnedOutFlatAndHeels) + } + "releve_straight_leg_and_knee_bent_with_one_leg_variation" => { + Ok(Self::ReleveStraightLegAndKneeBentWithOneLegVariation) + } + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SquatExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum TotalBodyExerciseName { Burpee, @@ -25745,6 +31345,32 @@ impl Serialize for TotalBodyExerciseName { } } } +impl FromStr for TotalBodyExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "burpee" => Ok(Self::Burpee), + "weighted_burpee" => Ok(Self::WeightedBurpee), + "burpee_box_jump" => Ok(Self::BurpeeBoxJump), + "weighted_burpee_box_jump" => Ok(Self::WeightedBurpeeBoxJump), + "high_pull_burpee" => Ok(Self::HighPullBurpee), + "man_makers" => Ok(Self::ManMakers), + "one_arm_burpee" => Ok(Self::OneArmBurpee), + "squat_thrusts" => Ok(Self::SquatThrusts), + "weighted_squat_thrusts" => Ok(Self::WeightedSquatThrusts), + "squat_plank_push_up" => Ok(Self::SquatPlankPushUp), + "weighted_squat_plank_push_up" => Ok(Self::WeightedSquatPlankPushUp), + "standing_t_rotation_balance" => Ok(Self::StandingTRotationBalance), + "weighted_standing_t_rotation_balance" => Ok(Self::WeightedStandingTRotationBalance), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for TotalBodyExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum TricepsExtensionExerciseName { BenchDip, @@ -26053,6 +31679,80 @@ impl Serialize for TricepsExtensionExerciseName { } } } +impl FromStr for TricepsExtensionExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "bench_dip" => Ok(Self::BenchDip), + "weighted_bench_dip" => Ok(Self::WeightedBenchDip), + "body_weight_dip" => Ok(Self::BodyWeightDip), + "cable_kickback" => Ok(Self::CableKickback), + "cable_lying_triceps_extension" => Ok(Self::CableLyingTricepsExtension), + "cable_overhead_triceps_extension" => Ok(Self::CableOverheadTricepsExtension), + "dumbbell_kickback" => Ok(Self::DumbbellKickback), + "dumbbell_lying_triceps_extension" => Ok(Self::DumbbellLyingTricepsExtension), + "ez_bar_overhead_triceps_extension" => Ok(Self::EzBarOverheadTricepsExtension), + "incline_dip" => Ok(Self::InclineDip), + "weighted_incline_dip" => Ok(Self::WeightedInclineDip), + "incline_ez_bar_lying_triceps_extension" => Ok(Self::InclineEzBarLyingTricepsExtension), + "lying_dumbbell_pullover_to_extension" => Ok(Self::LyingDumbbellPulloverToExtension), + "lying_ez_bar_triceps_extension" => Ok(Self::LyingEzBarTricepsExtension), + "lying_triceps_extension_to_close_grip_bench_press" => { + Ok(Self::LyingTricepsExtensionToCloseGripBenchPress) + } + "overhead_dumbbell_triceps_extension" => Ok(Self::OverheadDumbbellTricepsExtension), + "reclining_triceps_press" => Ok(Self::RecliningTricepsPress), + "reverse_grip_pressdown" => Ok(Self::ReverseGripPressdown), + "reverse_grip_triceps_pressdown" => Ok(Self::ReverseGripTricepsPressdown), + "rope_pressdown" => Ok(Self::RopePressdown), + "seated_barbell_overhead_triceps_extension" => { + Ok(Self::SeatedBarbellOverheadTricepsExtension) + } + "seated_dumbbell_overhead_triceps_extension" => { + Ok(Self::SeatedDumbbellOverheadTricepsExtension) + } + "seated_ez_bar_overhead_triceps_extension" => { + Ok(Self::SeatedEzBarOverheadTricepsExtension) + } + "seated_single_arm_overhead_dumbbell_extension" => { + Ok(Self::SeatedSingleArmOverheadDumbbellExtension) + } + "single_arm_dumbbell_overhead_triceps_extension" => { + Ok(Self::SingleArmDumbbellOverheadTricepsExtension) + } + "single_dumbbell_seated_overhead_triceps_extension" => { + Ok(Self::SingleDumbbellSeatedOverheadTricepsExtension) + } + "single_leg_bench_dip_and_kick" => Ok(Self::SingleLegBenchDipAndKick), + "weighted_single_leg_bench_dip_and_kick" => Ok(Self::WeightedSingleLegBenchDipAndKick), + "single_leg_dip" => Ok(Self::SingleLegDip), + "weighted_single_leg_dip" => Ok(Self::WeightedSingleLegDip), + "static_lying_triceps_extension" => Ok(Self::StaticLyingTricepsExtension), + "suspended_dip" => Ok(Self::SuspendedDip), + "weighted_suspended_dip" => Ok(Self::WeightedSuspendedDip), + "swiss_ball_dumbbell_lying_triceps_extension" => { + Ok(Self::SwissBallDumbbellLyingTricepsExtension) + } + "swiss_ball_ez_bar_lying_triceps_extension" => { + Ok(Self::SwissBallEzBarLyingTricepsExtension) + } + "swiss_ball_ez_bar_overhead_triceps_extension" => { + Ok(Self::SwissBallEzBarOverheadTricepsExtension) + } + "tabletop_dip" => Ok(Self::TabletopDip), + "weighted_tabletop_dip" => Ok(Self::WeightedTabletopDip), + "triceps_extension_on_floor" => Ok(Self::TricepsExtensionOnFloor), + "triceps_pressdown" => Ok(Self::TricepsPressdown), + "weighted_dip" => Ok(Self::WeightedDip), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for TricepsExtensionExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WarmUpExerciseName { QuadrupedRocking, @@ -26270,6 +31970,50 @@ impl Serialize for WarmUpExerciseName { } } } +impl FromStr for WarmUpExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "quadruped_rocking" => Ok(Self::QuadrupedRocking), + "neck_tilts" => Ok(Self::NeckTilts), + "ankle_circles" => Ok(Self::AnkleCircles), + "ankle_dorsiflexion_with_band" => Ok(Self::AnkleDorsiflexionWithBand), + "ankle_internal_rotation" => Ok(Self::AnkleInternalRotation), + "arm_circles" => Ok(Self::ArmCircles), + "bent_over_reach_to_sky" => Ok(Self::BentOverReachToSky), + "cat_camel" => Ok(Self::CatCamel), + "elbow_to_foot_lunge" => Ok(Self::ElbowToFootLunge), + "forward_and_backward_leg_swings" => Ok(Self::ForwardAndBackwardLegSwings), + "groiners" => Ok(Self::Groiners), + "inverted_hamstring_stretch" => Ok(Self::InvertedHamstringStretch), + "lateral_duck_under" => Ok(Self::LateralDuckUnder), + "neck_rotations" => Ok(Self::NeckRotations), + "opposite_arm_and_leg_balance" => Ok(Self::OppositeArmAndLegBalance), + "reach_roll_and_lift" => Ok(Self::ReachRollAndLift), + "scorpion" => Ok(Self::Scorpion), + "shoulder_circles" => Ok(Self::ShoulderCircles), + "side_to_side_leg_swings" => Ok(Self::SideToSideLegSwings), + "sleeper_stretch" => Ok(Self::SleeperStretch), + "slide_out" => Ok(Self::SlideOut), + "swiss_ball_hip_crossover" => Ok(Self::SwissBallHipCrossover), + "swiss_ball_reach_roll_and_lift" => Ok(Self::SwissBallReachRollAndLift), + "swiss_ball_windshield_wipers" => Ok(Self::SwissBallWindshieldWipers), + "thoracic_rotation" => Ok(Self::ThoracicRotation), + "walking_high_kicks" => Ok(Self::WalkingHighKicks), + "walking_high_knees" => Ok(Self::WalkingHighKnees), + "walking_knee_hugs" => Ok(Self::WalkingKneeHugs), + "walking_leg_cradles" => Ok(Self::WalkingLegCradles), + "walkout" => Ok(Self::Walkout), + "walkout_from_push_up_position" => Ok(Self::WalkoutFromPushUpPosition), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WarmUpExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum RunExerciseName { Run, @@ -26339,6 +32083,23 @@ impl Serialize for RunExerciseName { } } } +impl FromStr for RunExerciseName { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "run" => Ok(Self::Run), + "walk" => Ok(Self::Walk), + "jog" => Ok(Self::Jog), + "sprint" => Ok(Self::Sprint), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for RunExerciseName { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum WaterType { Fresh, @@ -26405,6 +32166,23 @@ impl Serialize for WaterType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for WaterType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "fresh" => Ok(Self::Fresh), + "salt" => Ok(Self::Salt), + "en13319" => Ok(Self::En13319), + "custom" => Ok(Self::Custom), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for WaterType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum TissueModelType { /// Buhlmann's decompression algorithm, version C @@ -26457,6 +32235,20 @@ impl Serialize for TissueModelType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for TissueModelType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "zhl_16c" => Ok(Self::Zhl16c), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for TissueModelType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DiveGasStatus { Disabled, @@ -26518,6 +32310,22 @@ impl Serialize for DiveGasStatus { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DiveGasStatus { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "disabled" => Ok(Self::Disabled), + "enabled" => Ok(Self::Enabled), + "backup_only" => Ok(Self::BackupOnly), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DiveGasStatus { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DiveAlert { NdlReached, @@ -26766,6 +32574,58 @@ impl Serialize for DiveAlert { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DiveAlert { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "ndl_reached" => Ok(Self::NdlReached), + "gas_switch_prompted" => Ok(Self::GasSwitchPrompted), + "near_surface" => Ok(Self::NearSurface), + "approaching_ndl" => Ok(Self::ApproachingNdl), + "po2_warn" => Ok(Self::Po2Warn), + "po2_crit_high" => Ok(Self::Po2CritHigh), + "po2_crit_low" => Ok(Self::Po2CritLow), + "time_alert" => Ok(Self::TimeAlert), + "depth_alert" => Ok(Self::DepthAlert), + "deco_ceiling_broken" => Ok(Self::DecoCeilingBroken), + "deco_complete" => Ok(Self::DecoComplete), + "safety_stop_broken" => Ok(Self::SafetyStopBroken), + "safety_stop_complete" => Ok(Self::SafetyStopComplete), + "cns_warning" => Ok(Self::CnsWarning), + "cns_critical" => Ok(Self::CnsCritical), + "otu_warning" => Ok(Self::OtuWarning), + "otu_critical" => Ok(Self::OtuCritical), + "ascent_critical" => Ok(Self::AscentCritical), + "alert_dismissed_by_key" => Ok(Self::AlertDismissedByKey), + "alert_dismissed_by_timeout" => Ok(Self::AlertDismissedByTimeout), + "battery_low" => Ok(Self::BatteryLow), + "battery_critical" => Ok(Self::BatteryCritical), + "safety_stop_started" => Ok(Self::SafetyStopStarted), + "approaching_first_deco_stop" => Ok(Self::ApproachingFirstDecoStop), + "setpoint_switch_auto_low" => Ok(Self::SetpointSwitchAutoLow), + "setpoint_switch_auto_high" => Ok(Self::SetpointSwitchAutoHigh), + "setpoint_switch_manual_low" => Ok(Self::SetpointSwitchManualLow), + "setpoint_switch_manual_high" => Ok(Self::SetpointSwitchManualHigh), + "auto_setpoint_switch_ignored" => Ok(Self::AutoSetpointSwitchIgnored), + "switched_to_open_circuit" => Ok(Self::SwitchedToOpenCircuit), + "switched_to_closed_circuit" => Ok(Self::SwitchedToClosedCircuit), + "tank_battery_low" => Ok(Self::TankBatteryLow), + "po2_ccr_dil_low" => Ok(Self::Po2CcrDilLow), + "deco_stop_cleared" => Ok(Self::DecoStopCleared), + "apnea_neutral_buoyancy" => Ok(Self::ApneaNeutralBuoyancy), + "apnea_target_depth" => Ok(Self::ApneaTargetDepth), + "apnea_surface" => Ok(Self::ApneaSurface), + "apnea_high_speed" => Ok(Self::ApneaHighSpeed), + "apnea_low_speed" => Ok(Self::ApneaLowSpeed), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DiveAlert { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DiveAlarmType { /// Alarm when a certain depth is crossed @@ -26830,6 +32690,22 @@ impl Serialize for DiveAlarmType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DiveAlarmType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "depth" => Ok(Self::Depth), + "time" => Ok(Self::Time), + "speed" => Ok(Self::Speed), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DiveAlarmType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DiveBacklightMode { AtDepth, @@ -26886,6 +32762,21 @@ impl Serialize for DiveBacklightMode { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DiveBacklightMode { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "at_depth" => Ok(Self::AtDepth), + "always_on" => Ok(Self::AlwaysOn), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DiveBacklightMode { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SleepLevel { Unmeasurable, @@ -26957,6 +32848,24 @@ impl Serialize for SleepLevel { serializer.serialize_str(&self.to_string()) } } +impl FromStr for SleepLevel { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "unmeasurable" => Ok(Self::Unmeasurable), + "awake" => Ok(Self::Awake), + "light" => Ok(Self::Light), + "deep" => Ok(Self::Deep), + "rem" => Ok(Self::Rem), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SleepLevel { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Spo2MeasurementType { OffWrist, @@ -27023,6 +32932,23 @@ impl Serialize for Spo2MeasurementType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for Spo2MeasurementType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "off_wrist" => Ok(Self::OffWrist), + "spot_check" => Ok(Self::SpotCheck), + "continuous_check" => Ok(Self::ContinuousCheck), + "periodic" => Ok(Self::Periodic), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for Spo2MeasurementType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum CcrSetpointSwitchMode { /// User switches setpoints manually @@ -27081,6 +33007,21 @@ impl Serialize for CcrSetpointSwitchMode { serializer.serialize_str(&self.to_string()) } } +impl FromStr for CcrSetpointSwitchMode { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "manual" => Ok(Self::Manual), + "automatic" => Ok(Self::Automatic), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for CcrSetpointSwitchMode { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum DiveGasMode { OpenCircuit, @@ -27137,6 +33078,21 @@ impl Serialize for DiveGasMode { serializer.serialize_str(&self.to_string()) } } +impl FromStr for DiveGasMode { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "open_circuit" => Ok(Self::OpenCircuit), + "closed_circuit_diluent" => Ok(Self::ClosedCircuitDiluent), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for DiveGasMode { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ProjectileType { /// Arrow projectile type @@ -27219,6 +33175,25 @@ impl Serialize for ProjectileType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for ProjectileType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "arrow" => Ok(Self::Arrow), + "rifle_cartridge" => Ok(Self::RifleCartridge), + "pistol_cartridge" => Ok(Self::PistolCartridge), + "shotshell" => Ok(Self::Shotshell), + "air_rifle_pellet" => Ok(Self::AirRiflePellet), + "other" => Ok(Self::Other), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ProjectileType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum FaveroProduct { AssiomaUno, @@ -27278,6 +33253,21 @@ impl Serialize for FaveroProduct { } } } +impl FromStr for FaveroProduct { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "assioma_uno" => Ok(Self::AssiomaUno), + "assioma_duo" => Ok(Self::AssiomaDuo), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for FaveroProduct { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum SplitType { AscentSplit, @@ -27433,6 +33423,40 @@ impl Serialize for SplitType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for SplitType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "ascent_split" => Ok(Self::AscentSplit), + "descent_split" => Ok(Self::DescentSplit), + "interval_active" => Ok(Self::IntervalActive), + "interval_rest" => Ok(Self::IntervalRest), + "interval_warmup" => Ok(Self::IntervalWarmup), + "interval_cooldown" => Ok(Self::IntervalCooldown), + "interval_recovery" => Ok(Self::IntervalRecovery), + "interval_other" => Ok(Self::IntervalOther), + "climb_active" => Ok(Self::ClimbActive), + "climb_rest" => Ok(Self::ClimbRest), + "surf_active" => Ok(Self::SurfActive), + "run_active" => Ok(Self::RunActive), + "run_rest" => Ok(Self::RunRest), + "workout_round" => Ok(Self::WorkoutRound), + "rwd_run" => Ok(Self::RwdRun), + "rwd_walk" => Ok(Self::RwdWalk), + "windsurf_active" => Ok(Self::WindsurfActive), + "rwd_stand" => Ok(Self::RwdStand), + "transition" => Ok(Self::Transition), + "ski_lift_split" => Ok(Self::SkiLiftSplit), + "ski_run_split" => Ok(Self::SkiRunSplit), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for SplitType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum ClimbProEvent { Approach, @@ -27494,6 +33518,22 @@ impl Serialize for ClimbProEvent { serializer.serialize_str(&self.to_string()) } } +impl FromStr for ClimbProEvent { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "approach" => Ok(Self::Approach), + "start" => Ok(Self::Start), + "complete" => Ok(Self::Complete), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for ClimbProEvent { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum GasConsumptionRateType { /// Pressure-based Surface Air Consumption @@ -27560,6 +33600,22 @@ impl Serialize for GasConsumptionRateType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for GasConsumptionRateType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "pressure_sac" => Ok(Self::PressureSac), + "volume_sac" => Ok(Self::VolumeSac), + "rmv" => Ok(Self::Rmv), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for GasConsumptionRateType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum TapSensitivity { High, @@ -27621,6 +33677,22 @@ impl Serialize for TapSensitivity { serializer.serialize_str(&self.to_string()) } } +impl FromStr for TapSensitivity { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "high" => Ok(Self::High), + "medium" => Ok(Self::Medium), + "low" => Ok(Self::Low), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for TapSensitivity { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum RadarThreatLevelType { ThreatUnknown, @@ -27687,6 +33759,23 @@ impl Serialize for RadarThreatLevelType { serializer.serialize_str(&self.to_string()) } } +impl FromStr for RadarThreatLevelType { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "threat_unknown" => Ok(Self::ThreatUnknown), + "threat_none" => Ok(Self::ThreatNone), + "threat_approaching" => Ok(Self::ThreatApproaching), + "threat_approaching_fast" => Ok(Self::ThreatApproachingFast), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for RadarThreatLevelType { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum MaxMetSpeedSource { OnboardGps, @@ -27748,6 +33837,22 @@ impl Serialize for MaxMetSpeedSource { serializer.serialize_str(&self.to_string()) } } +impl FromStr for MaxMetSpeedSource { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "onboard_gps" => Ok(Self::OnboardGps), + "connected_gps" => Ok(Self::ConnectedGps), + "cadence" => Ok(Self::Cadence), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for MaxMetSpeedSource { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum MaxMetHeartRateSource { /// Wrist Heart Rate Monitor @@ -27806,6 +33911,21 @@ impl Serialize for MaxMetHeartRateSource { serializer.serialize_str(&self.to_string()) } } +impl FromStr for MaxMetHeartRateSource { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "whr" => Ok(Self::Whr), + "hrm" => Ok(Self::Hrm), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for MaxMetHeartRateSource { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum HrvStatus { None, @@ -27877,6 +33997,24 @@ impl Serialize for HrvStatus { serializer.serialize_str(&self.to_string()) } } +impl FromStr for HrvStatus { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "none" => Ok(Self::None), + "poor" => Ok(Self::Poor), + "low" => Ok(Self::Low), + "unbalanced" => Ok(Self::Unbalanced), + "balanced" => Ok(Self::Balanced), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for HrvStatus { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum NoFlyTimeMode { /// Standard Diver Alert Network no-fly guidance @@ -27935,6 +34073,21 @@ impl Serialize for NoFlyTimeMode { serializer.serialize_str(&self.to_string()) } } +impl FromStr for NoFlyTimeMode { + type Err = EnumFromStrError; + fn from_str(s: &str) -> Result { + match s { + "standard" => Ok(Self::Standard), + "flat_24_hours" => Ok(Self::Flat24Hours), + _ => Err(EnumFromStrError), + } + } +} +impl FromValue for NoFlyTimeMode { + fn from_value_with_units(value: ValueWithUnits) -> Result { + super::parse_enum(value) + } +} /// Describe all possible data types of a field /// diff --git a/fitparser/src/profile/messages.rs b/fitparser/src/profile/messages.rs index 9bc1b71..8c8976c 100644 --- a/fitparser/src/profile/messages.rs +++ b/fitparser/src/profile/messages.rs @@ -1,10 +1,13 @@ #![allow(missing_docs)] #![doc = "Auto generated profile messages from FIT SDK Release: 21.133.00"] use crate::{ - profile::{FitMessage, MesgNum, MessageParseOptions, TryFromRecordError}, - FitDataRecord, Value, + profile::{ + field_types, FitMessage, FromValue, MesgNum, MessageParseOptions, TryFromRecordError, + }, + FitDataRecord, ValueWithUnits, }; use serde::Serialize; +use std::collections::BTreeMap; #[doc = r" All supported message types."] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub enum Message { @@ -422,17 +425,141 @@ impl Message { kind => Err(TryFromRecordError::UnsupportedMessageKind(kind)), } } + #[doc = r" Return all invalid fields in this message."] + pub fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + match self { + Self::FileId(message) => message.invalid_fields(), + Self::FileCreator(message) => message.invalid_fields(), + Self::TimestampCorrelation(message) => message.invalid_fields(), + Self::Software(message) => message.invalid_fields(), + Self::SlaveDevice(message) => message.invalid_fields(), + Self::Capabilities(message) => message.invalid_fields(), + Self::FileCapabilities(message) => message.invalid_fields(), + Self::MesgCapabilities(message) => message.invalid_fields(), + Self::FieldCapabilities(message) => message.invalid_fields(), + Self::DeviceSettings(message) => message.invalid_fields(), + Self::UserProfile(message) => message.invalid_fields(), + Self::HrmProfile(message) => message.invalid_fields(), + Self::SdmProfile(message) => message.invalid_fields(), + Self::BikeProfile(message) => message.invalid_fields(), + Self::Connectivity(message) => message.invalid_fields(), + Self::WatchfaceSettings(message) => message.invalid_fields(), + Self::OhrSettings(message) => message.invalid_fields(), + Self::TimeInZone(message) => message.invalid_fields(), + Self::ZonesTarget(message) => message.invalid_fields(), + Self::Sport(message) => message.invalid_fields(), + Self::HrZone(message) => message.invalid_fields(), + Self::SpeedZone(message) => message.invalid_fields(), + Self::CadenceZone(message) => message.invalid_fields(), + Self::PowerZone(message) => message.invalid_fields(), + Self::MetZone(message) => message.invalid_fields(), + Self::DiveSettings(message) => message.invalid_fields(), + Self::DiveAlarm(message) => message.invalid_fields(), + Self::DiveApneaAlarm(message) => message.invalid_fields(), + Self::DiveGas(message) => message.invalid_fields(), + Self::Goal(message) => message.invalid_fields(), + Self::Activity(message) => message.invalid_fields(), + Self::Session(message) => message.invalid_fields(), + Self::Lap(message) => message.invalid_fields(), + Self::Length(message) => message.invalid_fields(), + Self::Record(message) => message.invalid_fields(), + Self::Event(message) => message.invalid_fields(), + Self::DeviceInfo(message) => message.invalid_fields(), + Self::DeviceAuxBatteryInfo(message) => message.invalid_fields(), + Self::TrainingFile(message) => message.invalid_fields(), + Self::WeatherConditions(message) => message.invalid_fields(), + Self::WeatherAlert(message) => message.invalid_fields(), + Self::GpsMetadata(message) => message.invalid_fields(), + Self::CameraEvent(message) => message.invalid_fields(), + Self::GyroscopeData(message) => message.invalid_fields(), + Self::AccelerometerData(message) => message.invalid_fields(), + Self::MagnetometerData(message) => message.invalid_fields(), + Self::BarometerData(message) => message.invalid_fields(), + Self::ThreeDSensorCalibration(message) => message.invalid_fields(), + Self::OneDSensorCalibration(message) => message.invalid_fields(), + Self::VideoFrame(message) => message.invalid_fields(), + Self::ObdiiData(message) => message.invalid_fields(), + Self::NmeaSentence(message) => message.invalid_fields(), + Self::AviationAttitude(message) => message.invalid_fields(), + Self::Video(message) => message.invalid_fields(), + Self::VideoTitle(message) => message.invalid_fields(), + Self::VideoDescription(message) => message.invalid_fields(), + Self::VideoClip(message) => message.invalid_fields(), + Self::Set(message) => message.invalid_fields(), + Self::Jump(message) => message.invalid_fields(), + Self::Split(message) => message.invalid_fields(), + Self::SplitSummary(message) => message.invalid_fields(), + Self::ClimbPro(message) => message.invalid_fields(), + Self::FieldDescription(message) => message.invalid_fields(), + Self::DeveloperDataId(message) => message.invalid_fields(), + Self::Course(message) => message.invalid_fields(), + Self::CoursePoint(message) => message.invalid_fields(), + Self::SegmentId(message) => message.invalid_fields(), + Self::SegmentLeaderboardEntry(message) => message.invalid_fields(), + Self::SegmentPoint(message) => message.invalid_fields(), + Self::SegmentLap(message) => message.invalid_fields(), + Self::SegmentFile(message) => message.invalid_fields(), + Self::Workout(message) => message.invalid_fields(), + Self::WorkoutSession(message) => message.invalid_fields(), + Self::WorkoutStep(message) => message.invalid_fields(), + Self::ExerciseTitle(message) => message.invalid_fields(), + Self::Schedule(message) => message.invalid_fields(), + Self::Totals(message) => message.invalid_fields(), + Self::WeightScale(message) => message.invalid_fields(), + Self::BloodPressure(message) => message.invalid_fields(), + Self::MonitoringInfo(message) => message.invalid_fields(), + Self::Monitoring(message) => message.invalid_fields(), + Self::MonitoringHrData(message) => message.invalid_fields(), + Self::Spo2Data(message) => message.invalid_fields(), + Self::Hr(message) => message.invalid_fields(), + Self::StressLevel(message) => message.invalid_fields(), + Self::MaxMetData(message) => message.invalid_fields(), + Self::HsaBodyBatteryData(message) => message.invalid_fields(), + Self::HsaEvent(message) => message.invalid_fields(), + Self::HsaAccelerometerData(message) => message.invalid_fields(), + Self::HsaGyroscopeData(message) => message.invalid_fields(), + Self::HsaStepData(message) => message.invalid_fields(), + Self::HsaSpo2Data(message) => message.invalid_fields(), + Self::HsaStressData(message) => message.invalid_fields(), + Self::HsaRespirationData(message) => message.invalid_fields(), + Self::HsaHeartRateData(message) => message.invalid_fields(), + Self::HsaConfigurationData(message) => message.invalid_fields(), + Self::HsaWristTemperatureData(message) => message.invalid_fields(), + Self::MemoGlob(message) => message.invalid_fields(), + Self::SleepLevel(message) => message.invalid_fields(), + Self::AntChannelId(message) => message.invalid_fields(), + Self::AntRx(message) => message.invalid_fields(), + Self::AntTx(message) => message.invalid_fields(), + Self::ExdScreenConfiguration(message) => message.invalid_fields(), + Self::ExdDataFieldConfiguration(message) => message.invalid_fields(), + Self::ExdDataConceptConfiguration(message) => message.invalid_fields(), + Self::DiveSummary(message) => message.invalid_fields(), + Self::AadAccelFeatures(message) => message.invalid_fields(), + Self::Hrv(message) => message.invalid_fields(), + Self::BeatIntervals(message) => message.invalid_fields(), + Self::HrvStatusSummary(message) => message.invalid_fields(), + Self::HrvValue(message) => message.invalid_fields(), + Self::RawBbi(message) => message.invalid_fields(), + Self::RespirationRate(message) => message.invalid_fields(), + Self::ChronoShotSession(message) => message.invalid_fields(), + Self::ChronoShotData(message) => message.invalid_fields(), + Self::TankUpdate(message) => message.invalid_fields(), + Self::TankSummary(message) => message.invalid_fields(), + Self::SleepAssessment(message) => message.invalid_fields(), + } + } } #[doc = "Must be first message in file."] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct FileId { - pub r#type: Option, - pub r#manufacturer: Option, - pub r#product: Option, - pub r#serial_number: Option, - pub r#time_created: Option, - pub r#number: Option, - pub r#product_name: Option, + pub r#type: Option, + pub r#manufacturer: Option, + pub r#product: Option, + pub r#serial_number: Option, + pub r#time_created: Option, + pub r#number: Option, + pub r#product_name: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for FileId { const NAME: &'static str = "FileId"; @@ -451,29 +578,66 @@ impl FitMessage for FileId { let mut r#time_created = None; let mut r#number = None; let mut r#product_name = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#type = Some(field.into_value()); - } - 1u8 => { - r#manufacturer = Some(field.into_value()); - } - 2u8 => { - r#product = Some(field.into_value()); - } - 3u8 => { - r#serial_number = Some(field.into_value()); - } - 4u8 => { - r#time_created = Some(field.into_value()); - } - 5u8 => { - r#number = Some(field.into_value()); - } - 8u8 => { - r#product_name = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#type = Some(_value); + } + Err(value) => { + invalid_fields.insert("type", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#manufacturer = Some(_value); + } + Err(value) => { + invalid_fields.insert("manufacturer", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#product = Some(_value); + } + Err(value) => { + invalid_fields.insert("product", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#serial_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("serial_number", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_created = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_created", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#number = Some(_value); + } + Err(value) => { + invalid_fields.insert("number", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#product_name = Some(_value); + } + Err(value) => { + invalid_fields.insert("product_name", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -489,8 +653,12 @@ impl FitMessage for FileId { r#time_created, r#number, r#product_name, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for FileId { type Error = TryFromRecordError; @@ -500,8 +668,9 @@ impl TryFrom for FileId { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct FileCreator { - pub r#software_version: Option, - pub r#hardware_version: Option, + pub r#software_version: Option, + pub r#hardware_version: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for FileCreator { const NAME: &'static str = "FileCreator"; @@ -515,14 +684,26 @@ impl FitMessage for FileCreator { } let mut r#software_version = None; let mut r#hardware_version = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#software_version = Some(field.into_value()); - } - 1u8 => { - r#hardware_version = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#software_version = Some(_value); + } + Err(value) => { + invalid_fields.insert("software_version", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#hardware_version = Some(_value); + } + Err(value) => { + invalid_fields.insert("hardware_version", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -533,8 +714,12 @@ impl FitMessage for FileCreator { Ok(Self { r#software_version, r#hardware_version, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for FileCreator { type Error = TryFromRecordError; @@ -544,13 +729,14 @@ impl TryFrom for FileCreator { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct TimestampCorrelation { - pub r#fractional_timestamp: Option, - pub r#system_timestamp: Option, - pub r#fractional_system_timestamp: Option, - pub r#local_timestamp: Option, - pub r#timestamp_ms: Option, - pub r#system_timestamp_ms: Option, - pub r#timestamp: Option, + pub r#fractional_timestamp: Option, + pub r#system_timestamp: Option, + pub r#fractional_system_timestamp: Option, + pub r#local_timestamp: Option, + pub r#timestamp_ms: Option, + pub r#system_timestamp_ms: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for TimestampCorrelation { const NAME: &'static str = "TimestampCorrelation"; @@ -569,29 +755,66 @@ impl FitMessage for TimestampCorrelation { let mut r#timestamp_ms = None; let mut r#system_timestamp_ms = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#fractional_timestamp = Some(field.into_value()); - } - 1u8 => { - r#system_timestamp = Some(field.into_value()); - } - 2u8 => { - r#fractional_system_timestamp = Some(field.into_value()); - } - 3u8 => { - r#local_timestamp = Some(field.into_value()); - } - 4u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 5u8 => { - r#system_timestamp_ms = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#fractional_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("fractional_timestamp", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#system_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("system_timestamp", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#fractional_system_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("fractional_system_timestamp", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#local_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("local_timestamp", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#system_timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("system_timestamp_ms", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -607,8 +830,12 @@ impl FitMessage for TimestampCorrelation { r#timestamp_ms, r#system_timestamp_ms, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for TimestampCorrelation { type Error = TryFromRecordError; @@ -618,9 +845,10 @@ impl TryFrom for TimestampCorrelation { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Software { - pub r#version: Option, - pub r#part_number: Option, - pub r#message_index: Option, + pub r#version: Option, + pub r#part_number: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Software { const NAME: &'static str = "Software"; @@ -635,17 +863,34 @@ impl FitMessage for Software { let mut r#version = None; let mut r#part_number = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 3u8 => { - r#version = Some(field.into_value()); - } - 5u8 => { - r#part_number = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#version = Some(_value); + } + Err(value) => { + invalid_fields.insert("version", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#part_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("part_number", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -657,8 +902,12 @@ impl FitMessage for Software { r#version, r#part_number, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Software { type Error = TryFromRecordError; @@ -668,8 +917,9 @@ impl TryFrom for Software { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct SlaveDevice { - pub r#manufacturer: Option, - pub r#product: Option, + pub r#manufacturer: Option, + pub r#product: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for SlaveDevice { const NAME: &'static str = "SlaveDevice"; @@ -683,14 +933,26 @@ impl FitMessage for SlaveDevice { } let mut r#manufacturer = None; let mut r#product = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#manufacturer = Some(field.into_value()); - } - 1u8 => { - r#product = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#manufacturer = Some(_value); + } + Err(value) => { + invalid_fields.insert("manufacturer", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#product = Some(_value); + } + Err(value) => { + invalid_fields.insert("product", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -701,8 +963,12 @@ impl FitMessage for SlaveDevice { Ok(Self { r#manufacturer, r#product, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for SlaveDevice { type Error = TryFromRecordError; @@ -712,10 +978,11 @@ impl TryFrom for SlaveDevice { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Capabilities { - pub r#languages: Option, - pub r#sports: Option, - pub r#workouts_supported: Option, - pub r#connectivity_supported: Option, + pub r#languages: Option, + pub r#sports: Option, + pub r#workouts_supported: Option, + pub r#connectivity_supported: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Capabilities { const NAME: &'static str = "Capabilities"; @@ -731,20 +998,42 @@ impl FitMessage for Capabilities { let mut r#sports = None; let mut r#workouts_supported = None; let mut r#connectivity_supported = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#languages = Some(field.into_value()); - } - 1u8 => { - r#sports = Some(field.into_value()); - } - 21u8 => { - r#workouts_supported = Some(field.into_value()); - } - 23u8 => { - r#connectivity_supported = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#languages = Some(_value); + } + Err(value) => { + invalid_fields.insert("languages", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sports = Some(_value); + } + Err(value) => { + invalid_fields.insert("sports", value); + } + }, + 21u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#workouts_supported = Some(_value); + } + Err(value) => { + invalid_fields.insert("workouts_supported", value); + } + }, + 23u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#connectivity_supported = Some(_value); + } + Err(value) => { + invalid_fields.insert("connectivity_supported", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -757,8 +1046,12 @@ impl FitMessage for Capabilities { r#sports, r#workouts_supported, r#connectivity_supported, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Capabilities { type Error = TryFromRecordError; @@ -768,12 +1061,13 @@ impl TryFrom for Capabilities { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct FileCapabilities { - pub r#type: Option, - pub r#flags: Option, - pub r#directory: Option, - pub r#max_count: Option, - pub r#max_size: Option, - pub r#message_index: Option, + pub r#type: Option, + pub r#flags: Option, + pub r#directory: Option, + pub r#max_count: Option, + pub r#max_size: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for FileCapabilities { const NAME: &'static str = "FileCapabilities"; @@ -791,26 +1085,58 @@ impl FitMessage for FileCapabilities { let mut r#max_count = None; let mut r#max_size = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#type = Some(field.into_value()); - } - 1u8 => { - r#flags = Some(field.into_value()); - } - 2u8 => { - r#directory = Some(field.into_value()); - } - 3u8 => { - r#max_count = Some(field.into_value()); - } - 4u8 => { - r#max_size = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#type = Some(_value); + } + Err(value) => { + invalid_fields.insert("type", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#flags = Some(_value); + } + Err(value) => { + invalid_fields.insert("flags", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#directory = Some(_value); + } + Err(value) => { + invalid_fields.insert("directory", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_count", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_size = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_size", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -825,8 +1151,12 @@ impl FitMessage for FileCapabilities { r#max_count, r#max_size, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for FileCapabilities { type Error = TryFromRecordError; @@ -836,11 +1166,12 @@ impl TryFrom for FileCapabilities { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct MesgCapabilities { - pub r#file: Option, - pub r#mesg_num: Option, - pub r#count_type: Option, - pub r#count: Option, - pub r#message_index: Option, + pub r#file: Option, + pub r#mesg_num: Option, + pub r#count_type: Option, + pub r#count: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for MesgCapabilities { const NAME: &'static str = "MesgCapabilities"; @@ -857,23 +1188,50 @@ impl FitMessage for MesgCapabilities { let mut r#count_type = None; let mut r#count = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#file = Some(field.into_value()); - } - 1u8 => { - r#mesg_num = Some(field.into_value()); - } - 2u8 => { - r#count_type = Some(field.into_value()); - } - 3u8 => { - r#count = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#file = Some(_value); + } + Err(value) => { + invalid_fields.insert("file", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mesg_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("mesg_num", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#count_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("count_type", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#count = Some(_value); + } + Err(value) => { + invalid_fields.insert("count", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -887,8 +1245,12 @@ impl FitMessage for MesgCapabilities { r#count_type, r#count, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for MesgCapabilities { type Error = TryFromRecordError; @@ -898,11 +1260,12 @@ impl TryFrom for MesgCapabilities { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct FieldCapabilities { - pub r#file: Option, - pub r#mesg_num: Option, - pub r#field_num: Option, - pub r#count: Option, - pub r#message_index: Option, + pub r#file: Option, + pub r#mesg_num: Option, + pub r#field_num: Option, + pub r#count: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for FieldCapabilities { const NAME: &'static str = "FieldCapabilities"; @@ -919,23 +1282,50 @@ impl FitMessage for FieldCapabilities { let mut r#field_num = None; let mut r#count = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#file = Some(field.into_value()); - } - 1u8 => { - r#mesg_num = Some(field.into_value()); - } - 2u8 => { - r#field_num = Some(field.into_value()); - } - 3u8 => { - r#count = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#file = Some(_value); + } + Err(value) => { + invalid_fields.insert("file", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mesg_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("mesg_num", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#field_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("field_num", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#count = Some(_value); + } + Err(value) => { + invalid_fields.insert("count", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -949,8 +1339,12 @@ impl FitMessage for FieldCapabilities { r#field_num, r#count, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for FieldCapabilities { type Error = TryFromRecordError; @@ -960,30 +1354,31 @@ impl TryFrom for FieldCapabilities { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct DeviceSettings { - pub r#active_time_zone: Option, - pub r#utc_offset: Option, - pub r#time_offset: Option, - pub r#time_mode: Option, - pub r#time_zone_offset: Option, - pub r#backlight_mode: Option, - pub r#activity_tracker_enabled: Option, - pub r#clock_time: Option, - pub r#pages_enabled: Option, - pub r#move_alert_enabled: Option, - pub r#date_mode: Option, - pub r#display_orientation: Option, - pub r#mounting_side: Option, - pub r#default_page: Option, - pub r#autosync_min_steps: Option, - pub r#autosync_min_time: Option, - pub r#lactate_threshold_autodetect_enabled: Option, - pub r#ble_auto_upload_enabled: Option, - pub r#auto_sync_frequency: Option, - pub r#auto_activity_detect: Option, - pub r#number_of_screens: Option, - pub r#smart_notification_display_orientation: Option, - pub r#tap_interface: Option, - pub r#tap_sensitivity: Option, + pub r#active_time_zone: Option, + pub r#utc_offset: Option, + pub r#time_offset: Option, + pub r#time_mode: Option, + pub r#time_zone_offset: Option, + pub r#backlight_mode: Option, + pub r#activity_tracker_enabled: Option, + pub r#clock_time: Option, + pub r#pages_enabled: Option, + pub r#move_alert_enabled: Option, + pub r#date_mode: Option, + pub r#display_orientation: Option, + pub r#mounting_side: Option, + pub r#default_page: Option, + pub r#autosync_min_steps: Option, + pub r#autosync_min_time: Option, + pub r#lactate_threshold_autodetect_enabled: Option, + pub r#ble_auto_upload_enabled: Option, + pub r#auto_sync_frequency: Option, + pub r#auto_activity_detect: Option, + pub r#number_of_screens: Option, + pub r#smart_notification_display_orientation: Option, + pub r#tap_interface: Option, + pub r#tap_sensitivity: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for DeviceSettings { const NAME: &'static str = "DeviceSettings"; @@ -1019,80 +1414,202 @@ impl FitMessage for DeviceSettings { let mut r#smart_notification_display_orientation = None; let mut r#tap_interface = None; let mut r#tap_sensitivity = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#active_time_zone = Some(field.into_value()); - } - 1u8 => { - r#utc_offset = Some(field.into_value()); - } - 2u8 => { - r#time_offset = Some(field.into_value()); - } - 4u8 => { - r#time_mode = Some(field.into_value()); - } - 5u8 => { - r#time_zone_offset = Some(field.into_value()); - } - 12u8 => { - r#backlight_mode = Some(field.into_value()); - } - 36u8 => { - r#activity_tracker_enabled = Some(field.into_value()); - } - 39u8 => { - r#clock_time = Some(field.into_value()); - } - 40u8 => { - r#pages_enabled = Some(field.into_value()); - } - 46u8 => { - r#move_alert_enabled = Some(field.into_value()); - } - 47u8 => { - r#date_mode = Some(field.into_value()); - } - 55u8 => { - r#display_orientation = Some(field.into_value()); - } - 56u8 => { - r#mounting_side = Some(field.into_value()); - } - 57u8 => { - r#default_page = Some(field.into_value()); - } - 58u8 => { - r#autosync_min_steps = Some(field.into_value()); - } - 59u8 => { - r#autosync_min_time = Some(field.into_value()); - } - 80u8 => { - r#lactate_threshold_autodetect_enabled = Some(field.into_value()); - } - 86u8 => { - r#ble_auto_upload_enabled = Some(field.into_value()); - } - 89u8 => { - r#auto_sync_frequency = Some(field.into_value()); - } - 90u8 => { - r#auto_activity_detect = Some(field.into_value()); - } - 94u8 => { - r#number_of_screens = Some(field.into_value()); - } - 95u8 => { - r#smart_notification_display_orientation = Some(field.into_value()); - } - 134u8 => { - r#tap_interface = Some(field.into_value()); - } - 174u8 => { - r#tap_sensitivity = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#active_time_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("active_time_zone", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#utc_offset = Some(_value); + } + Err(value) => { + invalid_fields.insert("utc_offset", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_offset = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_offset", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_mode = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_mode", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_zone_offset = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_zone_offset", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#backlight_mode = Some(_value); + } + Err(value) => { + invalid_fields.insert("backlight_mode", value); + } + }, + 36u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#activity_tracker_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("activity_tracker_enabled", value); + } + }, + 39u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#clock_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("clock_time", value); + } + }, + 40u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pages_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("pages_enabled", value); + } + }, + 46u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#move_alert_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("move_alert_enabled", value); + } + }, + 47u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#date_mode = Some(_value); + } + Err(value) => { + invalid_fields.insert("date_mode", value); + } + }, + 55u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#display_orientation = Some(_value); + } + Err(value) => { + invalid_fields.insert("display_orientation", value); + } + }, + 56u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mounting_side = Some(_value); + } + Err(value) => { + invalid_fields.insert("mounting_side", value); + } + }, + 57u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#default_page = Some(_value); + } + Err(value) => { + invalid_fields.insert("default_page", value); + } + }, + 58u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#autosync_min_steps = Some(_value); + } + Err(value) => { + invalid_fields.insert("autosync_min_steps", value); + } + }, + 59u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#autosync_min_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("autosync_min_time", value); + } + }, + 80u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#lactate_threshold_autodetect_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("lactate_threshold_autodetect_enabled", value); + } + }, + 86u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ble_auto_upload_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("ble_auto_upload_enabled", value); + } + }, + 89u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#auto_sync_frequency = Some(_value); + } + Err(value) => { + invalid_fields.insert("auto_sync_frequency", value); + } + }, + 90u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#auto_activity_detect = Some(_value); + } + Err(value) => { + invalid_fields.insert("auto_activity_detect", value); + } + }, + 94u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#number_of_screens = Some(_value); + } + Err(value) => { + invalid_fields.insert("number_of_screens", value); + } + }, + 95u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#smart_notification_display_orientation = Some(_value); + } + Err(value) => { + invalid_fields.insert("smart_notification_display_orientation", value); + } + }, + 134u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#tap_interface = Some(_value); + } + Err(value) => { + invalid_fields.insert("tap_interface", value); + } + }, + 174u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#tap_sensitivity = Some(_value); + } + Err(value) => { + invalid_fields.insert("tap_sensitivity", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -1125,8 +1642,12 @@ impl FitMessage for DeviceSettings { r#smart_notification_display_orientation, r#tap_interface, r#tap_sensitivity, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for DeviceSettings { type Error = TryFromRecordError; @@ -1136,35 +1657,36 @@ impl TryFrom for DeviceSettings { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct UserProfile { - pub r#friendly_name: Option, - pub r#gender: Option, - pub r#age: Option, - pub r#height: Option, - pub r#weight: Option, - pub r#language: Option, - pub r#elev_setting: Option, - pub r#weight_setting: Option, - pub r#resting_heart_rate: Option, - pub r#default_max_running_heart_rate: Option, - pub r#default_max_biking_heart_rate: Option, - pub r#default_max_heart_rate: Option, - pub r#hr_setting: Option, - pub r#speed_setting: Option, - pub r#dist_setting: Option, - pub r#power_setting: Option, - pub r#activity_class: Option, - pub r#position_setting: Option, - pub r#temperature_setting: Option, - pub r#local_id: Option, - pub r#global_id: Option, - pub r#wake_time: Option, - pub r#sleep_time: Option, - pub r#height_setting: Option, - pub r#user_running_step_length: Option, - pub r#user_walking_step_length: Option, - pub r#depth_setting: Option, - pub r#dive_count: Option, - pub r#message_index: Option, + pub r#friendly_name: Option, + pub r#gender: Option, + pub r#age: Option, + pub r#height: Option, + pub r#weight: Option, + pub r#language: Option, + pub r#elev_setting: Option, + pub r#weight_setting: Option, + pub r#resting_heart_rate: Option, + pub r#default_max_running_heart_rate: Option, + pub r#default_max_biking_heart_rate: Option, + pub r#default_max_heart_rate: Option, + pub r#hr_setting: Option, + pub r#speed_setting: Option, + pub r#dist_setting: Option, + pub r#power_setting: Option, + pub r#activity_class: Option, + pub r#position_setting: Option, + pub r#temperature_setting: Option, + pub r#local_id: Option, + pub r#global_id: Option, + pub r#wake_time: Option, + pub r#sleep_time: Option, + pub r#height_setting: Option, + pub r#user_running_step_length: Option, + pub r#user_walking_step_length: Option, + pub r#depth_setting: Option, + pub r#dive_count: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for UserProfile { const NAME: &'static str = "UserProfile"; @@ -1205,116 +1727,263 @@ impl FitMessage for UserProfile { let mut r#depth_setting = None; let mut r#dive_count = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#friendly_name = Some(field.into_value()); - } - 1u8 => { - r#gender = Some(field.into_value()); - } - 2u8 => { - r#age = Some(field.into_value()); - } - 3u8 => { - r#height = Some(field.into_value()); - } - 4u8 => { - r#weight = Some(field.into_value()); - } - 5u8 => { - r#language = Some(field.into_value()); - } - 6u8 => { - r#elev_setting = Some(field.into_value()); - } - 7u8 => { - r#weight_setting = Some(field.into_value()); - } - 8u8 => { - r#resting_heart_rate = Some(field.into_value()); - } - 9u8 => { - r#default_max_running_heart_rate = Some(field.into_value()); - } - 10u8 => { - r#default_max_biking_heart_rate = Some(field.into_value()); - } - 11u8 => { - r#default_max_heart_rate = Some(field.into_value()); - } - 12u8 => { - r#hr_setting = Some(field.into_value()); - } - 13u8 => { - r#speed_setting = Some(field.into_value()); - } - 14u8 => { - r#dist_setting = Some(field.into_value()); - } - 16u8 => { - r#power_setting = Some(field.into_value()); - } - 17u8 => { - r#activity_class = Some(field.into_value()); - } - 18u8 => { - r#position_setting = Some(field.into_value()); - } - 21u8 => { - r#temperature_setting = Some(field.into_value()); - } - 22u8 => { - r#local_id = Some(field.into_value()); - } - 23u8 => { - r#global_id = Some(field.into_value()); - } - 28u8 => { - r#wake_time = Some(field.into_value()); - } - 29u8 => { - r#sleep_time = Some(field.into_value()); - } - 30u8 => { - r#height_setting = Some(field.into_value()); - } - 31u8 => { - r#user_running_step_length = Some(field.into_value()); - } - 32u8 => { - r#user_walking_step_length = Some(field.into_value()); - } - 47u8 => { - r#depth_setting = Some(field.into_value()); - } - 49u8 => { - r#dive_count = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } - _ => { - if !options.ignore_unexpected_fields { - return Err(TryFromRecordError::unexpected_field(&field)); + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#friendly_name = Some(_value); } - } - } - } - Ok(Self { - r#friendly_name, - r#gender, - r#age, - r#height, - r#weight, - r#language, - r#elev_setting, - r#weight_setting, - r#resting_heart_rate, - r#default_max_running_heart_rate, - r#default_max_biking_heart_rate, - r#default_max_heart_rate, - r#hr_setting, + Err(value) => { + invalid_fields.insert("friendly_name", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gender = Some(_value); + } + Err(value) => { + invalid_fields.insert("gender", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#age = Some(_value); + } + Err(value) => { + invalid_fields.insert("age", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#height = Some(_value); + } + Err(value) => { + invalid_fields.insert("height", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#weight = Some(_value); + } + Err(value) => { + invalid_fields.insert("weight", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#language = Some(_value); + } + Err(value) => { + invalid_fields.insert("language", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#elev_setting = Some(_value); + } + Err(value) => { + invalid_fields.insert("elev_setting", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#weight_setting = Some(_value); + } + Err(value) => { + invalid_fields.insert("weight_setting", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#resting_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("resting_heart_rate", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#default_max_running_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("default_max_running_heart_rate", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#default_max_biking_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("default_max_biking_heart_rate", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#default_max_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("default_max_heart_rate", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#hr_setting = Some(_value); + } + Err(value) => { + invalid_fields.insert("hr_setting", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#speed_setting = Some(_value); + } + Err(value) => { + invalid_fields.insert("speed_setting", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#dist_setting = Some(_value); + } + Err(value) => { + invalid_fields.insert("dist_setting", value); + } + }, + 16u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#power_setting = Some(_value); + } + Err(value) => { + invalid_fields.insert("power_setting", value); + } + }, + 17u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#activity_class = Some(_value); + } + Err(value) => { + invalid_fields.insert("activity_class", value); + } + }, + 18u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_setting = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_setting", value); + } + }, + 21u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#temperature_setting = Some(_value); + } + Err(value) => { + invalid_fields.insert("temperature_setting", value); + } + }, + 22u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#local_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("local_id", value); + } + }, + 23u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#global_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("global_id", value); + } + }, + 28u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#wake_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("wake_time", value); + } + }, + 29u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sleep_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("sleep_time", value); + } + }, + 30u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#height_setting = Some(_value); + } + Err(value) => { + invalid_fields.insert("height_setting", value); + } + }, + 31u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#user_running_step_length = Some(_value); + } + Err(value) => { + invalid_fields.insert("user_running_step_length", value); + } + }, + 32u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#user_walking_step_length = Some(_value); + } + Err(value) => { + invalid_fields.insert("user_walking_step_length", value); + } + }, + 47u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#depth_setting = Some(_value); + } + Err(value) => { + invalid_fields.insert("depth_setting", value); + } + }, + 49u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#dive_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("dive_count", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, + _ => { + if !options.ignore_unexpected_fields { + return Err(TryFromRecordError::unexpected_field(&field)); + } + } + } + } + Ok(Self { + r#friendly_name, + r#gender, + r#age, + r#height, + r#weight, + r#language, + r#elev_setting, + r#weight_setting, + r#resting_heart_rate, + r#default_max_running_heart_rate, + r#default_max_biking_heart_rate, + r#default_max_heart_rate, + r#hr_setting, r#speed_setting, r#dist_setting, r#power_setting, @@ -1331,8 +2000,12 @@ impl FitMessage for UserProfile { r#depth_setting, r#dive_count, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for UserProfile { type Error = TryFromRecordError; @@ -1342,11 +2015,12 @@ impl TryFrom for UserProfile { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HrmProfile { - pub r#enabled: Option, - pub r#hrm_ant_id: Option, - pub r#log_hrv: Option, - pub r#hrm_ant_id_trans_type: Option, - pub r#message_index: Option, + pub r#enabled: Option, + pub r#hrm_ant_id: Option, + pub r#log_hrv: Option, + pub r#hrm_ant_id_trans_type: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HrmProfile { const NAME: &'static str = "HrmProfile"; @@ -1363,23 +2037,50 @@ impl FitMessage for HrmProfile { let mut r#log_hrv = None; let mut r#hrm_ant_id_trans_type = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#enabled = Some(field.into_value()); - } - 1u8 => { - r#hrm_ant_id = Some(field.into_value()); - } - 2u8 => { - r#log_hrv = Some(field.into_value()); - } - 3u8 => { - r#hrm_ant_id_trans_type = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("enabled", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#hrm_ant_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("hrm_ant_id", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#log_hrv = Some(_value); + } + Err(value) => { + invalid_fields.insert("log_hrv", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#hrm_ant_id_trans_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("hrm_ant_id_trans_type", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -1393,8 +2094,12 @@ impl FitMessage for HrmProfile { r#log_hrv, r#hrm_ant_id_trans_type, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HrmProfile { type Error = TryFromRecordError; @@ -1404,14 +2109,15 @@ impl TryFrom for HrmProfile { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct SdmProfile { - pub r#enabled: Option, - pub r#sdm_ant_id: Option, - pub r#sdm_cal_factor: Option, - pub r#odometer: Option, - pub r#speed_source: Option, - pub r#sdm_ant_id_trans_type: Option, - pub r#odometer_rollover: Option, - pub r#message_index: Option, + pub r#enabled: Option, + pub r#sdm_ant_id: Option, + pub r#sdm_cal_factor: Option, + pub r#odometer: Option, + pub r#speed_source: Option, + pub r#sdm_ant_id_trans_type: Option, + pub r#odometer_rollover: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for SdmProfile { const NAME: &'static str = "SdmProfile"; @@ -1431,32 +2137,74 @@ impl FitMessage for SdmProfile { let mut r#sdm_ant_id_trans_type = None; let mut r#odometer_rollover = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#enabled = Some(field.into_value()); - } - 1u8 => { - r#sdm_ant_id = Some(field.into_value()); - } - 2u8 => { - r#sdm_cal_factor = Some(field.into_value()); - } - 3u8 => { - r#odometer = Some(field.into_value()); - } - 4u8 => { - r#speed_source = Some(field.into_value()); - } - 5u8 => { - r#sdm_ant_id_trans_type = Some(field.into_value()); - } - 7u8 => { - r#odometer_rollover = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("enabled", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sdm_ant_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("sdm_ant_id", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sdm_cal_factor = Some(_value); + } + Err(value) => { + invalid_fields.insert("sdm_cal_factor", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#odometer = Some(_value); + } + Err(value) => { + invalid_fields.insert("odometer", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#speed_source = Some(_value); + } + Err(value) => { + invalid_fields.insert("speed_source", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sdm_ant_id_trans_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("sdm_ant_id_trans_type", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#odometer_rollover = Some(_value); + } + Err(value) => { + invalid_fields.insert("odometer_rollover", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -1473,8 +2221,12 @@ impl FitMessage for SdmProfile { r#sdm_ant_id_trans_type, r#odometer_rollover, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for SdmProfile { type Error = TryFromRecordError; @@ -1484,38 +2236,39 @@ impl TryFrom for SdmProfile { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct BikeProfile { - pub r#name: Option, - pub r#sport: Option, - pub r#sub_sport: Option, - pub r#odometer: Option, - pub r#bike_spd_ant_id: Option, - pub r#bike_cad_ant_id: Option, - pub r#bike_spdcad_ant_id: Option, - pub r#bike_power_ant_id: Option, - pub r#custom_wheelsize: Option, - pub r#auto_wheelsize: Option, - pub r#bike_weight: Option, - pub r#power_cal_factor: Option, - pub r#auto_wheel_cal: Option, - pub r#auto_power_zero: Option, - pub r#id: Option, - pub r#spd_enabled: Option, - pub r#cad_enabled: Option, - pub r#spdcad_enabled: Option, - pub r#power_enabled: Option, - pub r#crank_length: Option, - pub r#enabled: Option, - pub r#bike_spd_ant_id_trans_type: Option, - pub r#bike_cad_ant_id_trans_type: Option, - pub r#bike_spdcad_ant_id_trans_type: Option, - pub r#bike_power_ant_id_trans_type: Option, - pub r#odometer_rollover: Option, - pub r#front_gear_num: Option, - pub r#front_gear: Option, - pub r#rear_gear_num: Option, - pub r#rear_gear: Option, - pub r#shimano_di2_enabled: Option, - pub r#message_index: Option, + pub r#name: Option, + pub r#sport: Option, + pub r#sub_sport: Option, + pub r#odometer: Option, + pub r#bike_spd_ant_id: Option, + pub r#bike_cad_ant_id: Option, + pub r#bike_spdcad_ant_id: Option, + pub r#bike_power_ant_id: Option, + pub r#custom_wheelsize: Option, + pub r#auto_wheelsize: Option, + pub r#bike_weight: Option, + pub r#power_cal_factor: Option, + pub r#auto_wheel_cal: Option, + pub r#auto_power_zero: Option, + pub r#id: Option, + pub r#spd_enabled: Option, + pub r#cad_enabled: Option, + pub r#spdcad_enabled: Option, + pub r#power_enabled: Option, + pub r#crank_length: Option, + pub r#enabled: Option, + pub r#bike_spd_ant_id_trans_type: Option, + pub r#bike_cad_ant_id_trans_type: Option, + pub r#bike_spdcad_ant_id_trans_type: Option, + pub r#bike_power_ant_id_trans_type: Option, + pub r#odometer_rollover: Option, + pub r#front_gear_num: Option, + pub r#front_gear: Option, + pub r#rear_gear_num: Option, + pub r#rear_gear: Option, + pub r#shimano_di2_enabled: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for BikeProfile { const NAME: &'static str = "BikeProfile"; @@ -1559,104 +2312,266 @@ impl FitMessage for BikeProfile { let mut r#rear_gear = None; let mut r#shimano_di2_enabled = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#name = Some(field.into_value()); - } - 1u8 => { - r#sport = Some(field.into_value()); - } - 2u8 => { - r#sub_sport = Some(field.into_value()); - } - 3u8 => { - r#odometer = Some(field.into_value()); - } - 4u8 => { - r#bike_spd_ant_id = Some(field.into_value()); - } - 5u8 => { - r#bike_cad_ant_id = Some(field.into_value()); - } - 6u8 => { - r#bike_spdcad_ant_id = Some(field.into_value()); - } - 7u8 => { - r#bike_power_ant_id = Some(field.into_value()); - } - 8u8 => { - r#custom_wheelsize = Some(field.into_value()); - } - 9u8 => { - r#auto_wheelsize = Some(field.into_value()); - } - 10u8 => { - r#bike_weight = Some(field.into_value()); - } - 11u8 => { - r#power_cal_factor = Some(field.into_value()); - } - 12u8 => { - r#auto_wheel_cal = Some(field.into_value()); - } - 13u8 => { - r#auto_power_zero = Some(field.into_value()); - } - 14u8 => { - r#id = Some(field.into_value()); - } - 15u8 => { - r#spd_enabled = Some(field.into_value()); - } - 16u8 => { - r#cad_enabled = Some(field.into_value()); - } - 17u8 => { - r#spdcad_enabled = Some(field.into_value()); - } - 18u8 => { - r#power_enabled = Some(field.into_value()); - } - 19u8 => { - r#crank_length = Some(field.into_value()); - } - 20u8 => { - r#enabled = Some(field.into_value()); - } - 21u8 => { - r#bike_spd_ant_id_trans_type = Some(field.into_value()); - } - 22u8 => { - r#bike_cad_ant_id_trans_type = Some(field.into_value()); - } - 23u8 => { - r#bike_spdcad_ant_id_trans_type = Some(field.into_value()); - } - 24u8 => { - r#bike_power_ant_id_trans_type = Some(field.into_value()); - } - 37u8 => { - r#odometer_rollover = Some(field.into_value()); - } - 38u8 => { - r#front_gear_num = Some(field.into_value()); - } - 39u8 => { - r#front_gear = Some(field.into_value()); - } - 40u8 => { - r#rear_gear_num = Some(field.into_value()); - } - 41u8 => { - r#rear_gear = Some(field.into_value()); - } - 44u8 => { - r#shimano_di2_enabled = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sub_sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sub_sport", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#odometer = Some(_value); + } + Err(value) => { + invalid_fields.insert("odometer", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bike_spd_ant_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("bike_spd_ant_id", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bike_cad_ant_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("bike_cad_ant_id", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bike_spdcad_ant_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("bike_spdcad_ant_id", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bike_power_ant_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("bike_power_ant_id", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#custom_wheelsize = Some(_value); + } + Err(value) => { + invalid_fields.insert("custom_wheelsize", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#auto_wheelsize = Some(_value); + } + Err(value) => { + invalid_fields.insert("auto_wheelsize", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bike_weight = Some(_value); + } + Err(value) => { + invalid_fields.insert("bike_weight", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#power_cal_factor = Some(_value); + } + Err(value) => { + invalid_fields.insert("power_cal_factor", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#auto_wheel_cal = Some(_value); + } + Err(value) => { + invalid_fields.insert("auto_wheel_cal", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#auto_power_zero = Some(_value); + } + Err(value) => { + invalid_fields.insert("auto_power_zero", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#id = Some(_value); + } + Err(value) => { + invalid_fields.insert("id", value); + } + }, + 15u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#spd_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("spd_enabled", value); + } + }, + 16u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cad_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("cad_enabled", value); + } + }, + 17u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#spdcad_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("spdcad_enabled", value); + } + }, + 18u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#power_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("power_enabled", value); + } + }, + 19u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#crank_length = Some(_value); + } + Err(value) => { + invalid_fields.insert("crank_length", value); + } + }, + 20u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("enabled", value); + } + }, + 21u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bike_spd_ant_id_trans_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("bike_spd_ant_id_trans_type", value); + } + }, + 22u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bike_cad_ant_id_trans_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("bike_cad_ant_id_trans_type", value); + } + }, + 23u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bike_spdcad_ant_id_trans_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("bike_spdcad_ant_id_trans_type", value); + } + }, + 24u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bike_power_ant_id_trans_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("bike_power_ant_id_trans_type", value); + } + }, + 37u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#odometer_rollover = Some(_value); + } + Err(value) => { + invalid_fields.insert("odometer_rollover", value); + } + }, + 38u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#front_gear_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("front_gear_num", value); + } + }, + 39u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#front_gear = Some(_value); + } + Err(value) => { + invalid_fields.insert("front_gear", value); + } + }, + 40u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#rear_gear_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("rear_gear_num", value); + } + }, + 41u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#rear_gear = Some(_value); + } + Err(value) => { + invalid_fields.insert("rear_gear", value); + } + }, + 44u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#shimano_di2_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("shimano_di2_enabled", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -1697,8 +2612,12 @@ impl FitMessage for BikeProfile { r#rear_gear, r#shimano_di2_enabled, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for BikeProfile { type Error = TryFromRecordError; @@ -1708,19 +2627,20 @@ impl TryFrom for BikeProfile { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Connectivity { - pub r#bluetooth_enabled: Option, - pub r#bluetooth_le_enabled: Option, - pub r#ant_enabled: Option, - pub r#name: Option, - pub r#live_tracking_enabled: Option, - pub r#weather_conditions_enabled: Option, - pub r#weather_alerts_enabled: Option, - pub r#auto_activity_upload_enabled: Option, - pub r#course_download_enabled: Option, - pub r#workout_download_enabled: Option, - pub r#gps_ephemeris_download_enabled: Option, - pub r#incident_detection_enabled: Option, - pub r#grouptrack_enabled: Option, + pub r#bluetooth_enabled: Option, + pub r#bluetooth_le_enabled: Option, + pub r#ant_enabled: Option, + pub r#name: Option, + pub r#live_tracking_enabled: Option, + pub r#weather_conditions_enabled: Option, + pub r#weather_alerts_enabled: Option, + pub r#auto_activity_upload_enabled: Option, + pub r#course_download_enabled: Option, + pub r#workout_download_enabled: Option, + pub r#gps_ephemeris_download_enabled: Option, + pub r#incident_detection_enabled: Option, + pub r#grouptrack_enabled: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Connectivity { const NAME: &'static str = "Connectivity"; @@ -1745,47 +2665,114 @@ impl FitMessage for Connectivity { let mut r#gps_ephemeris_download_enabled = None; let mut r#incident_detection_enabled = None; let mut r#grouptrack_enabled = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#bluetooth_enabled = Some(field.into_value()); - } - 1u8 => { - r#bluetooth_le_enabled = Some(field.into_value()); - } - 2u8 => { - r#ant_enabled = Some(field.into_value()); - } - 3u8 => { - r#name = Some(field.into_value()); - } - 4u8 => { - r#live_tracking_enabled = Some(field.into_value()); - } - 5u8 => { - r#weather_conditions_enabled = Some(field.into_value()); - } - 6u8 => { - r#weather_alerts_enabled = Some(field.into_value()); - } - 7u8 => { - r#auto_activity_upload_enabled = Some(field.into_value()); - } - 8u8 => { - r#course_download_enabled = Some(field.into_value()); - } - 9u8 => { - r#workout_download_enabled = Some(field.into_value()); - } - 10u8 => { - r#gps_ephemeris_download_enabled = Some(field.into_value()); - } - 11u8 => { - r#incident_detection_enabled = Some(field.into_value()); - } - 12u8 => { - r#grouptrack_enabled = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bluetooth_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("bluetooth_enabled", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bluetooth_le_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("bluetooth_le_enabled", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ant_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("ant_enabled", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#live_tracking_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("live_tracking_enabled", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#weather_conditions_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("weather_conditions_enabled", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#weather_alerts_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("weather_alerts_enabled", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#auto_activity_upload_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("auto_activity_upload_enabled", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#course_download_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("course_download_enabled", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#workout_download_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("workout_download_enabled", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gps_ephemeris_download_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("gps_ephemeris_download_enabled", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#incident_detection_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("incident_detection_enabled", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#grouptrack_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("grouptrack_enabled", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -1807,8 +2794,12 @@ impl FitMessage for Connectivity { r#gps_ephemeris_download_enabled, r#incident_detection_enabled, r#grouptrack_enabled, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Connectivity { type Error = TryFromRecordError; @@ -1818,9 +2809,10 @@ impl TryFrom for Connectivity { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct WatchfaceSettings { - pub r#mode: Option, - pub r#layout: Option, - pub r#message_index: Option, + pub r#mode: Option, + pub r#layout: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for WatchfaceSettings { const NAME: &'static str = "WatchfaceSettings"; @@ -1835,17 +2827,34 @@ impl FitMessage for WatchfaceSettings { let mut r#mode = None; let mut r#layout = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#mode = Some(field.into_value()); - } - 1u8 => { - r#layout = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mode = Some(_value); + } + Err(value) => { + invalid_fields.insert("mode", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#layout = Some(_value); + } + Err(value) => { + invalid_fields.insert("layout", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -1857,8 +2866,12 @@ impl FitMessage for WatchfaceSettings { r#mode, r#layout, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for WatchfaceSettings { type Error = TryFromRecordError; @@ -1868,8 +2881,9 @@ impl TryFrom for WatchfaceSettings { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct OhrSettings { - pub r#enabled: Option, - pub r#timestamp: Option, + pub r#enabled: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for OhrSettings { const NAME: &'static str = "OhrSettings"; @@ -1883,14 +2897,26 @@ impl FitMessage for OhrSettings { } let mut r#enabled = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#enabled = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("enabled", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -1901,8 +2927,12 @@ impl FitMessage for OhrSettings { Ok(Self { r#enabled, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for OhrSettings { type Error = TryFromRecordError; @@ -1912,23 +2942,24 @@ impl TryFrom for OhrSettings { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct TimeInZone { - pub r#reference_mesg: Option, - pub r#reference_index: Option, - pub r#time_in_hr_zone: Option, - pub r#time_in_speed_zone: Option, - pub r#time_in_cadence_zone: Option, - pub r#time_in_power_zone: Option, - pub r#hr_zone_high_boundary: Option, - pub r#speed_zone_high_boundary: Option, - pub r#cadence_zone_high_bondary: Option, - pub r#power_zone_high_boundary: Option, - pub r#hr_calc_type: Option, - pub r#max_heart_rate: Option, - pub r#resting_heart_rate: Option, - pub r#threshold_heart_rate: Option, - pub r#pwr_calc_type: Option, - pub r#functional_threshold_power: Option, - pub r#timestamp: Option, + pub r#reference_mesg: Option, + pub r#reference_index: Option, + pub r#time_in_hr_zone: Option, + pub r#time_in_speed_zone: Option, + pub r#time_in_cadence_zone: Option, + pub r#time_in_power_zone: Option, + pub r#hr_zone_high_boundary: Option, + pub r#speed_zone_high_boundary: Option, + pub r#cadence_zone_high_bondary: Option, + pub r#power_zone_high_boundary: Option, + pub r#hr_calc_type: Option, + pub r#max_heart_rate: Option, + pub r#resting_heart_rate: Option, + pub r#threshold_heart_rate: Option, + pub r#pwr_calc_type: Option, + pub r#functional_threshold_power: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for TimeInZone { const NAME: &'static str = "TimeInZone"; @@ -1957,59 +2988,146 @@ impl FitMessage for TimeInZone { let mut r#pwr_calc_type = None; let mut r#functional_threshold_power = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#reference_mesg = Some(field.into_value()); - } - 1u8 => { - r#reference_index = Some(field.into_value()); - } - 2u8 => { - r#time_in_hr_zone = Some(field.into_value()); - } - 3u8 => { - r#time_in_speed_zone = Some(field.into_value()); - } - 4u8 => { - r#time_in_cadence_zone = Some(field.into_value()); - } - 5u8 => { - r#time_in_power_zone = Some(field.into_value()); - } - 6u8 => { - r#hr_zone_high_boundary = Some(field.into_value()); - } - 7u8 => { - r#speed_zone_high_boundary = Some(field.into_value()); - } - 8u8 => { - r#cadence_zone_high_bondary = Some(field.into_value()); - } - 9u8 => { - r#power_zone_high_boundary = Some(field.into_value()); - } - 10u8 => { - r#hr_calc_type = Some(field.into_value()); - } - 11u8 => { - r#max_heart_rate = Some(field.into_value()); - } - 12u8 => { - r#resting_heart_rate = Some(field.into_value()); - } - 13u8 => { - r#threshold_heart_rate = Some(field.into_value()); - } - 14u8 => { - r#pwr_calc_type = Some(field.into_value()); - } - 15u8 => { - r#functional_threshold_power = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#reference_mesg = Some(_value); + } + Err(value) => { + invalid_fields.insert("reference_mesg", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#reference_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("reference_index", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_hr_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_hr_zone", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_speed_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_speed_zone", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_cadence_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_cadence_zone", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_power_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_power_zone", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#hr_zone_high_boundary = Some(_value); + } + Err(value) => { + invalid_fields.insert("hr_zone_high_boundary", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#speed_zone_high_boundary = Some(_value); + } + Err(value) => { + invalid_fields.insert("speed_zone_high_boundary", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cadence_zone_high_bondary = Some(_value); + } + Err(value) => { + invalid_fields.insert("cadence_zone_high_bondary", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#power_zone_high_boundary = Some(_value); + } + Err(value) => { + invalid_fields.insert("power_zone_high_boundary", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#hr_calc_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("hr_calc_type", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_heart_rate", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#resting_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("resting_heart_rate", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#threshold_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("threshold_heart_rate", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pwr_calc_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("pwr_calc_type", value); + } + }, + 15u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#functional_threshold_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("functional_threshold_power", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -2035,8 +3153,12 @@ impl FitMessage for TimeInZone { r#pwr_calc_type, r#functional_threshold_power, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for TimeInZone { type Error = TryFromRecordError; @@ -2046,11 +3168,12 @@ impl TryFrom for TimeInZone { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct ZonesTarget { - pub r#max_heart_rate: Option, - pub r#threshold_heart_rate: Option, - pub r#functional_threshold_power: Option, - pub r#hr_calc_type: Option, - pub r#pwr_calc_type: Option, + pub r#max_heart_rate: Option, + pub r#threshold_heart_rate: Option, + pub r#functional_threshold_power: Option, + pub r#hr_calc_type: Option, + pub r#pwr_calc_type: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for ZonesTarget { const NAME: &'static str = "ZonesTarget"; @@ -2067,23 +3190,50 @@ impl FitMessage for ZonesTarget { let mut r#functional_threshold_power = None; let mut r#hr_calc_type = None; let mut r#pwr_calc_type = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 1u8 => { - r#max_heart_rate = Some(field.into_value()); - } - 2u8 => { - r#threshold_heart_rate = Some(field.into_value()); - } - 3u8 => { - r#functional_threshold_power = Some(field.into_value()); - } - 5u8 => { - r#hr_calc_type = Some(field.into_value()); - } - 7u8 => { - r#pwr_calc_type = Some(field.into_value()); - } + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_heart_rate", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#threshold_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("threshold_heart_rate", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#functional_threshold_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("functional_threshold_power", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#hr_calc_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("hr_calc_type", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pwr_calc_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("pwr_calc_type", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -2097,8 +3247,12 @@ impl FitMessage for ZonesTarget { r#functional_threshold_power, r#hr_calc_type, r#pwr_calc_type, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for ZonesTarget { type Error = TryFromRecordError; @@ -2108,9 +3262,10 @@ impl TryFrom for ZonesTarget { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Sport { - pub r#sport: Option, - pub r#sub_sport: Option, - pub r#name: Option, + pub r#sport: Option, + pub r#sub_sport: Option, + pub r#name: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Sport { const NAME: &'static str = "Sport"; @@ -2125,17 +3280,34 @@ impl FitMessage for Sport { let mut r#sport = None; let mut r#sub_sport = None; let mut r#name = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#sport = Some(field.into_value()); - } - 1u8 => { - r#sub_sport = Some(field.into_value()); - } - 3u8 => { - r#name = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sub_sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sub_sport", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -2147,8 +3319,12 @@ impl FitMessage for Sport { r#sport, r#sub_sport, r#name, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Sport { type Error = TryFromRecordError; @@ -2158,9 +3334,10 @@ impl TryFrom for Sport { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HrZone { - pub r#high_bpm: Option, - pub r#name: Option, - pub r#message_index: Option, + pub r#high_bpm: Option, + pub r#name: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HrZone { const NAME: &'static str = "HrZone"; @@ -2175,17 +3352,34 @@ impl FitMessage for HrZone { let mut r#high_bpm = None; let mut r#name = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 1u8 => { - r#high_bpm = Some(field.into_value()); - } - 2u8 => { - r#name = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#high_bpm = Some(_value); + } + Err(value) => { + invalid_fields.insert("high_bpm", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -2197,8 +3391,12 @@ impl FitMessage for HrZone { r#high_bpm, r#name, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HrZone { type Error = TryFromRecordError; @@ -2208,9 +3406,10 @@ impl TryFrom for HrZone { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct SpeedZone { - pub r#high_value: Option, - pub r#name: Option, - pub r#message_index: Option, + pub r#high_value: Option, + pub r#name: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for SpeedZone { const NAME: &'static str = "SpeedZone"; @@ -2225,17 +3424,34 @@ impl FitMessage for SpeedZone { let mut r#high_value = None; let mut r#name = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#high_value = Some(field.into_value()); - } - 1u8 => { - r#name = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#high_value = Some(_value); + } + Err(value) => { + invalid_fields.insert("high_value", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -2247,8 +3463,12 @@ impl FitMessage for SpeedZone { r#high_value, r#name, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for SpeedZone { type Error = TryFromRecordError; @@ -2258,9 +3478,10 @@ impl TryFrom for SpeedZone { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct CadenceZone { - pub r#high_value: Option, - pub r#name: Option, - pub r#message_index: Option, + pub r#high_value: Option, + pub r#name: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for CadenceZone { const NAME: &'static str = "CadenceZone"; @@ -2275,17 +3496,34 @@ impl FitMessage for CadenceZone { let mut r#high_value = None; let mut r#name = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#high_value = Some(field.into_value()); - } - 1u8 => { - r#name = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#high_value = Some(_value); + } + Err(value) => { + invalid_fields.insert("high_value", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -2297,8 +3535,12 @@ impl FitMessage for CadenceZone { r#high_value, r#name, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for CadenceZone { type Error = TryFromRecordError; @@ -2308,9 +3550,10 @@ impl TryFrom for CadenceZone { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct PowerZone { - pub r#high_value: Option, - pub r#name: Option, - pub r#message_index: Option, + pub r#high_value: Option, + pub r#name: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for PowerZone { const NAME: &'static str = "PowerZone"; @@ -2325,17 +3568,34 @@ impl FitMessage for PowerZone { let mut r#high_value = None; let mut r#name = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 1u8 => { - r#high_value = Some(field.into_value()); - } - 2u8 => { - r#name = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#high_value = Some(_value); + } + Err(value) => { + invalid_fields.insert("high_value", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -2347,8 +3607,12 @@ impl FitMessage for PowerZone { r#high_value, r#name, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for PowerZone { type Error = TryFromRecordError; @@ -2358,10 +3622,11 @@ impl TryFrom for PowerZone { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct MetZone { - pub r#high_bpm: Option, - pub r#calories: Option, - pub r#fat_calories: Option, - pub r#message_index: Option, + pub r#high_bpm: Option, + pub r#calories: Option, + pub r#fat_calories: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for MetZone { const NAME: &'static str = "MetZone"; @@ -2377,20 +3642,42 @@ impl FitMessage for MetZone { let mut r#calories = None; let mut r#fat_calories = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 1u8 => { - r#high_bpm = Some(field.into_value()); - } - 2u8 => { - r#calories = Some(field.into_value()); - } - 3u8 => { - r#fat_calories = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#high_bpm = Some(_value); + } + Err(value) => { + invalid_fields.insert("high_bpm", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("calories", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#fat_calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("fat_calories", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -2403,8 +3690,12 @@ impl FitMessage for MetZone { r#calories, r#fat_calories, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for MetZone { type Error = TryFromRecordError; @@ -2414,41 +3705,42 @@ impl TryFrom for MetZone { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct DiveSettings { - pub r#name: Option, - pub r#model: Option, - pub r#gf_low: Option, - pub r#gf_high: Option, - pub r#water_type: Option, - pub r#water_density: Option, - pub r#po2_warn: Option, - pub r#po2_critical: Option, - pub r#po2_deco: Option, - pub r#safety_stop_enabled: Option, - pub r#bottom_depth: Option, - pub r#bottom_time: Option, - pub r#apnea_countdown_enabled: Option, - pub r#apnea_countdown_time: Option, - pub r#backlight_mode: Option, - pub r#backlight_brightness: Option, - pub r#backlight_timeout: Option, - pub r#repeat_dive_interval: Option, - pub r#safety_stop_time: Option, - pub r#heart_rate_source_type: Option, - pub r#heart_rate_source: Option, - pub r#travel_gas: Option, - pub r#ccr_low_setpoint_switch_mode: Option, - pub r#ccr_low_setpoint: Option, - pub r#ccr_low_setpoint_depth: Option, - pub r#ccr_high_setpoint_switch_mode: Option, - pub r#ccr_high_setpoint: Option, - pub r#ccr_high_setpoint_depth: Option, - pub r#gas_consumption_display: Option, - pub r#up_key_enabled: Option, - pub r#dive_sounds: Option, - pub r#last_stop_multiple: Option, - pub r#no_fly_time_mode: Option, - pub r#timestamp: Option, - pub r#message_index: Option, + pub r#name: Option, + pub r#model: Option, + pub r#gf_low: Option, + pub r#gf_high: Option, + pub r#water_type: Option, + pub r#water_density: Option, + pub r#po2_warn: Option, + pub r#po2_critical: Option, + pub r#po2_deco: Option, + pub r#safety_stop_enabled: Option, + pub r#bottom_depth: Option, + pub r#bottom_time: Option, + pub r#apnea_countdown_enabled: Option, + pub r#apnea_countdown_time: Option, + pub r#backlight_mode: Option, + pub r#backlight_brightness: Option, + pub r#backlight_timeout: Option, + pub r#repeat_dive_interval: Option, + pub r#safety_stop_time: Option, + pub r#heart_rate_source_type: Option, + pub r#heart_rate_source: Option, + pub r#travel_gas: Option, + pub r#ccr_low_setpoint_switch_mode: Option, + pub r#ccr_low_setpoint: Option, + pub r#ccr_low_setpoint_depth: Option, + pub r#ccr_high_setpoint_switch_mode: Option, + pub r#ccr_high_setpoint: Option, + pub r#ccr_high_setpoint_depth: Option, + pub r#gas_consumption_display: Option, + pub r#up_key_enabled: Option, + pub r#dive_sounds: Option, + pub r#last_stop_multiple: Option, + pub r#no_fly_time_mode: Option, + pub r#timestamp: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for DiveSettings { const NAME: &'static str = "DiveSettings"; @@ -2495,113 +3787,290 @@ impl FitMessage for DiveSettings { let mut r#no_fly_time_mode = None; let mut r#timestamp = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#name = Some(field.into_value()); - } - 1u8 => { - r#model = Some(field.into_value()); - } - 2u8 => { - r#gf_low = Some(field.into_value()); - } - 3u8 => { - r#gf_high = Some(field.into_value()); - } - 4u8 => { - r#water_type = Some(field.into_value()); - } - 5u8 => { - r#water_density = Some(field.into_value()); - } - 6u8 => { - r#po2_warn = Some(field.into_value()); - } - 7u8 => { - r#po2_critical = Some(field.into_value()); - } - 8u8 => { - r#po2_deco = Some(field.into_value()); - } - 9u8 => { - r#safety_stop_enabled = Some(field.into_value()); - } - 10u8 => { - r#bottom_depth = Some(field.into_value()); - } - 11u8 => { - r#bottom_time = Some(field.into_value()); - } - 12u8 => { - r#apnea_countdown_enabled = Some(field.into_value()); - } - 13u8 => { - r#apnea_countdown_time = Some(field.into_value()); - } - 14u8 => { - r#backlight_mode = Some(field.into_value()); - } - 15u8 => { - r#backlight_brightness = Some(field.into_value()); - } - 16u8 => { - r#backlight_timeout = Some(field.into_value()); - } - 17u8 => { - r#repeat_dive_interval = Some(field.into_value()); - } - 18u8 => { - r#safety_stop_time = Some(field.into_value()); - } - 19u8 => { - r#heart_rate_source_type = Some(field.into_value()); - } - 20u8 => { - r#heart_rate_source = Some(field.into_value()); - } - 21u8 => { - r#travel_gas = Some(field.into_value()); - } - 22u8 => { - r#ccr_low_setpoint_switch_mode = Some(field.into_value()); - } - 23u8 => { - r#ccr_low_setpoint = Some(field.into_value()); - } - 24u8 => { - r#ccr_low_setpoint_depth = Some(field.into_value()); - } - 25u8 => { - r#ccr_high_setpoint_switch_mode = Some(field.into_value()); - } - 26u8 => { - r#ccr_high_setpoint = Some(field.into_value()); - } - 27u8 => { - r#ccr_high_setpoint_depth = Some(field.into_value()); - } - 29u8 => { - r#gas_consumption_display = Some(field.into_value()); - } - 30u8 => { - r#up_key_enabled = Some(field.into_value()); - } - 35u8 => { - r#dive_sounds = Some(field.into_value()); - } - 36u8 => { - r#last_stop_multiple = Some(field.into_value()); - } - 37u8 => { - r#no_fly_time_mode = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#model = Some(_value); + } + Err(value) => { + invalid_fields.insert("model", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gf_low = Some(_value); + } + Err(value) => { + invalid_fields.insert("gf_low", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gf_high = Some(_value); + } + Err(value) => { + invalid_fields.insert("gf_high", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#water_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("water_type", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#water_density = Some(_value); + } + Err(value) => { + invalid_fields.insert("water_density", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#po2_warn = Some(_value); + } + Err(value) => { + invalid_fields.insert("po2_warn", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#po2_critical = Some(_value); + } + Err(value) => { + invalid_fields.insert("po2_critical", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#po2_deco = Some(_value); + } + Err(value) => { + invalid_fields.insert("po2_deco", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#safety_stop_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("safety_stop_enabled", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bottom_depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("bottom_depth", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bottom_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("bottom_time", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#apnea_countdown_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("apnea_countdown_enabled", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#apnea_countdown_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("apnea_countdown_time", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#backlight_mode = Some(_value); + } + Err(value) => { + invalid_fields.insert("backlight_mode", value); + } + }, + 15u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#backlight_brightness = Some(_value); + } + Err(value) => { + invalid_fields.insert("backlight_brightness", value); + } + }, + 16u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#backlight_timeout = Some(_value); + } + Err(value) => { + invalid_fields.insert("backlight_timeout", value); + } + }, + 17u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#repeat_dive_interval = Some(_value); + } + Err(value) => { + invalid_fields.insert("repeat_dive_interval", value); + } + }, + 18u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#safety_stop_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("safety_stop_time", value); + } + }, + 19u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#heart_rate_source_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("heart_rate_source_type", value); + } + }, + 20u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#heart_rate_source = Some(_value); + } + Err(value) => { + invalid_fields.insert("heart_rate_source", value); + } + }, + 21u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#travel_gas = Some(_value); + } + Err(value) => { + invalid_fields.insert("travel_gas", value); + } + }, + 22u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ccr_low_setpoint_switch_mode = Some(_value); + } + Err(value) => { + invalid_fields.insert("ccr_low_setpoint_switch_mode", value); + } + }, + 23u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ccr_low_setpoint = Some(_value); + } + Err(value) => { + invalid_fields.insert("ccr_low_setpoint", value); + } + }, + 24u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ccr_low_setpoint_depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("ccr_low_setpoint_depth", value); + } + }, + 25u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ccr_high_setpoint_switch_mode = Some(_value); + } + Err(value) => { + invalid_fields.insert("ccr_high_setpoint_switch_mode", value); + } + }, + 26u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ccr_high_setpoint = Some(_value); + } + Err(value) => { + invalid_fields.insert("ccr_high_setpoint", value); + } + }, + 27u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ccr_high_setpoint_depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("ccr_high_setpoint_depth", value); + } + }, + 29u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gas_consumption_display = Some(_value); + } + Err(value) => { + invalid_fields.insert("gas_consumption_display", value); + } + }, + 30u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#up_key_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("up_key_enabled", value); + } + }, + 35u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#dive_sounds = Some(_value); + } + Err(value) => { + invalid_fields.insert("dive_sounds", value); + } + }, + 36u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#last_stop_multiple = Some(_value); + } + Err(value) => { + invalid_fields.insert("last_stop_multiple", value); + } + }, + 37u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#no_fly_time_mode = Some(_value); + } + Err(value) => { + invalid_fields.insert("no_fly_time_mode", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -2645,8 +4114,12 @@ impl FitMessage for DiveSettings { r#no_fly_time_mode, r#timestamp, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for DiveSettings { type Error = TryFromRecordError; @@ -2656,19 +4129,20 @@ impl TryFrom for DiveSettings { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct DiveAlarm { - pub r#depth: Option, - pub r#time: Option, - pub r#enabled: Option, - pub r#alarm_type: Option, - pub r#sound: Option, - pub r#dive_types: Option, - pub r#id: Option, - pub r#popup_enabled: Option, - pub r#trigger_on_descent: Option, - pub r#trigger_on_ascent: Option, - pub r#repeating: Option, - pub r#speed: Option, - pub r#message_index: Option, + pub r#depth: Option, + pub r#time: Option, + pub r#enabled: Option, + pub r#alarm_type: Option, + pub r#sound: Option, + pub r#dive_types: Option, + pub r#id: Option, + pub r#popup_enabled: Option, + pub r#trigger_on_descent: Option, + pub r#trigger_on_ascent: Option, + pub r#repeating: Option, + pub r#speed: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for DiveAlarm { const NAME: &'static str = "DiveAlarm"; @@ -2693,47 +4167,114 @@ impl FitMessage for DiveAlarm { let mut r#repeating = None; let mut r#speed = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#depth = Some(field.into_value()); - } - 1u8 => { - r#time = Some(field.into_value()); - } - 2u8 => { - r#enabled = Some(field.into_value()); - } - 3u8 => { - r#alarm_type = Some(field.into_value()); - } - 4u8 => { - r#sound = Some(field.into_value()); - } - 5u8 => { - r#dive_types = Some(field.into_value()); - } - 6u8 => { - r#id = Some(field.into_value()); - } - 7u8 => { - r#popup_enabled = Some(field.into_value()); - } - 8u8 => { - r#trigger_on_descent = Some(field.into_value()); - } - 9u8 => { - r#trigger_on_ascent = Some(field.into_value()); - } - 10u8 => { - r#repeating = Some(field.into_value()); - } - 11u8 => { - r#speed = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("depth", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time = Some(_value); + } + Err(value) => { + invalid_fields.insert("time", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("enabled", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#alarm_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("alarm_type", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sound = Some(_value); + } + Err(value) => { + invalid_fields.insert("sound", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#dive_types = Some(_value); + } + Err(value) => { + invalid_fields.insert("dive_types", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#id = Some(_value); + } + Err(value) => { + invalid_fields.insert("id", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#popup_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("popup_enabled", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#trigger_on_descent = Some(_value); + } + Err(value) => { + invalid_fields.insert("trigger_on_descent", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#trigger_on_ascent = Some(_value); + } + Err(value) => { + invalid_fields.insert("trigger_on_ascent", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#repeating = Some(_value); + } + Err(value) => { + invalid_fields.insert("repeating", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("speed", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -2755,8 +4296,12 @@ impl FitMessage for DiveAlarm { r#repeating, r#speed, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for DiveAlarm { type Error = TryFromRecordError; @@ -2766,19 +4311,20 @@ impl TryFrom for DiveAlarm { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct DiveApneaAlarm { - pub r#depth: Option, - pub r#time: Option, - pub r#enabled: Option, - pub r#alarm_type: Option, - pub r#sound: Option, - pub r#dive_types: Option, - pub r#id: Option, - pub r#popup_enabled: Option, - pub r#trigger_on_descent: Option, - pub r#trigger_on_ascent: Option, - pub r#repeating: Option, - pub r#speed: Option, - pub r#message_index: Option, + pub r#depth: Option, + pub r#time: Option, + pub r#enabled: Option, + pub r#alarm_type: Option, + pub r#sound: Option, + pub r#dive_types: Option, + pub r#id: Option, + pub r#popup_enabled: Option, + pub r#trigger_on_descent: Option, + pub r#trigger_on_ascent: Option, + pub r#repeating: Option, + pub r#speed: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for DiveApneaAlarm { const NAME: &'static str = "DiveApneaAlarm"; @@ -2803,47 +4349,114 @@ impl FitMessage for DiveApneaAlarm { let mut r#repeating = None; let mut r#speed = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#depth = Some(field.into_value()); - } - 1u8 => { - r#time = Some(field.into_value()); - } - 2u8 => { - r#enabled = Some(field.into_value()); - } - 3u8 => { - r#alarm_type = Some(field.into_value()); - } - 4u8 => { - r#sound = Some(field.into_value()); - } - 5u8 => { - r#dive_types = Some(field.into_value()); - } - 6u8 => { - r#id = Some(field.into_value()); - } - 7u8 => { - r#popup_enabled = Some(field.into_value()); - } - 8u8 => { - r#trigger_on_descent = Some(field.into_value()); - } - 9u8 => { - r#trigger_on_ascent = Some(field.into_value()); - } - 10u8 => { - r#repeating = Some(field.into_value()); - } - 11u8 => { - r#speed = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("depth", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time = Some(_value); + } + Err(value) => { + invalid_fields.insert("time", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("enabled", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#alarm_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("alarm_type", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sound = Some(_value); + } + Err(value) => { + invalid_fields.insert("sound", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#dive_types = Some(_value); + } + Err(value) => { + invalid_fields.insert("dive_types", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#id = Some(_value); + } + Err(value) => { + invalid_fields.insert("id", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#popup_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("popup_enabled", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#trigger_on_descent = Some(_value); + } + Err(value) => { + invalid_fields.insert("trigger_on_descent", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#trigger_on_ascent = Some(_value); + } + Err(value) => { + invalid_fields.insert("trigger_on_ascent", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#repeating = Some(_value); + } + Err(value) => { + invalid_fields.insert("repeating", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("speed", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -2865,8 +4478,12 @@ impl FitMessage for DiveApneaAlarm { r#repeating, r#speed, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for DiveApneaAlarm { type Error = TryFromRecordError; @@ -2876,11 +4493,12 @@ impl TryFrom for DiveApneaAlarm { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct DiveGas { - pub r#helium_content: Option, - pub r#oxygen_content: Option, - pub r#status: Option, - pub r#mode: Option, - pub r#message_index: Option, + pub r#helium_content: Option, + pub r#oxygen_content: Option, + pub r#status: Option, + pub r#mode: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for DiveGas { const NAME: &'static str = "DiveGas"; @@ -2897,23 +4515,50 @@ impl FitMessage for DiveGas { let mut r#status = None; let mut r#mode = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#helium_content = Some(field.into_value()); - } - 1u8 => { - r#oxygen_content = Some(field.into_value()); - } - 2u8 => { - r#status = Some(field.into_value()); - } - 3u8 => { - r#mode = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#helium_content = Some(_value); + } + Err(value) => { + invalid_fields.insert("helium_content", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#oxygen_content = Some(_value); + } + Err(value) => { + invalid_fields.insert("oxygen_content", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#status = Some(_value); + } + Err(value) => { + invalid_fields.insert("status", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mode = Some(_value); + } + Err(value) => { + invalid_fields.insert("mode", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -2927,8 +4572,12 @@ impl FitMessage for DiveGas { r#status, r#mode, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for DiveGas { type Error = TryFromRecordError; @@ -2938,19 +4587,20 @@ impl TryFrom for DiveGas { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Goal { - pub r#sport: Option, - pub r#sub_sport: Option, - pub r#start_date: Option, - pub r#end_date: Option, - pub r#type: Option, - pub r#value: Option, - pub r#repeat: Option, - pub r#target_value: Option, - pub r#recurrence: Option, - pub r#recurrence_value: Option, - pub r#enabled: Option, - pub r#source: Option, - pub r#message_index: Option, + pub r#sport: Option, + pub r#sub_sport: Option, + pub r#start_date: Option, + pub r#end_date: Option, + pub r#type: Option, + pub r#value: Option, + pub r#repeat: Option, + pub r#target_value: Option, + pub r#recurrence: Option, + pub r#recurrence_value: Option, + pub r#enabled: Option, + pub r#source: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Goal { const NAME: &'static str = "Goal"; @@ -2975,47 +4625,114 @@ impl FitMessage for Goal { let mut r#enabled = None; let mut r#source = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#sport = Some(field.into_value()); - } - 1u8 => { - r#sub_sport = Some(field.into_value()); - } - 2u8 => { - r#start_date = Some(field.into_value()); - } - 3u8 => { - r#end_date = Some(field.into_value()); - } - 4u8 => { - r#type = Some(field.into_value()); - } - 5u8 => { - r#value = Some(field.into_value()); - } - 6u8 => { - r#repeat = Some(field.into_value()); - } - 7u8 => { - r#target_value = Some(field.into_value()); - } - 8u8 => { - r#recurrence = Some(field.into_value()); - } - 9u8 => { - r#recurrence_value = Some(field.into_value()); - } - 10u8 => { - r#enabled = Some(field.into_value()); - } - 11u8 => { - r#source = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sub_sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sub_sport", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_date = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_date", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_date = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_date", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#type = Some(_value); + } + Err(value) => { + invalid_fields.insert("type", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#value = Some(_value); + } + Err(value) => { + invalid_fields.insert("value", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#repeat = Some(_value); + } + Err(value) => { + invalid_fields.insert("repeat", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#target_value = Some(_value); + } + Err(value) => { + invalid_fields.insert("target_value", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#recurrence = Some(_value); + } + Err(value) => { + invalid_fields.insert("recurrence", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#recurrence_value = Some(_value); + } + Err(value) => { + invalid_fields.insert("recurrence_value", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("enabled", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#source = Some(_value); + } + Err(value) => { + invalid_fields.insert("source", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -3037,8 +4754,12 @@ impl FitMessage for Goal { r#enabled, r#source, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Goal { type Error = TryFromRecordError; @@ -3048,14 +4769,15 @@ impl TryFrom for Goal { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Activity { - pub r#total_timer_time: Option, - pub r#num_sessions: Option, - pub r#type: Option, - pub r#event: Option, - pub r#event_type: Option, - pub r#local_timestamp: Option, - pub r#event_group: Option, - pub r#timestamp: Option, + pub r#total_timer_time: Option, + pub r#num_sessions: Option, + pub r#type: Option, + pub r#event: Option, + pub r#event_type: Option, + pub r#local_timestamp: Option, + pub r#event_group: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Activity { const NAME: &'static str = "Activity"; @@ -3075,32 +4797,74 @@ impl FitMessage for Activity { let mut r#local_timestamp = None; let mut r#event_group = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#total_timer_time = Some(field.into_value()); - } - 1u8 => { - r#num_sessions = Some(field.into_value()); - } - 2u8 => { - r#type = Some(field.into_value()); - } - 3u8 => { - r#event = Some(field.into_value()); - } - 4u8 => { - r#event_type = Some(field.into_value()); - } - 5u8 => { - r#local_timestamp = Some(field.into_value()); - } - 6u8 => { - r#event_group = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_timer_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_timer_time", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#num_sessions = Some(_value); + } + Err(value) => { + invalid_fields.insert("num_sessions", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#type = Some(_value); + } + Err(value) => { + invalid_fields.insert("type", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event = Some(_value); + } + Err(value) => { + invalid_fields.insert("event", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_type", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#local_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("local_timestamp", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_group = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_group", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -3117,8 +4881,12 @@ impl FitMessage for Activity { r#local_timestamp, r#event_group, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Activity { type Error = TryFromRecordError; @@ -3128,160 +4896,161 @@ impl TryFrom for Activity { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Session { - pub r#event: Option, - pub r#event_type: Option, - pub r#start_time: Option, - pub r#start_position_lat: Option, - pub r#start_position_long: Option, - pub r#sport: Option, - pub r#sub_sport: Option, - pub r#total_elapsed_time: Option, - pub r#total_timer_time: Option, - pub r#total_distance: Option, - pub r#total_cycles: Option, - pub r#total_calories: Option, - pub r#total_fat_calories: Option, - pub r#avg_speed: Option, - pub r#max_speed: Option, - pub r#avg_heart_rate: Option, - pub r#max_heart_rate: Option, - pub r#avg_cadence: Option, - pub r#max_cadence: Option, - pub r#avg_power: Option, - pub r#max_power: Option, - pub r#total_ascent: Option, - pub r#total_descent: Option, - pub r#total_training_effect: Option, - pub r#first_lap_index: Option, - pub r#num_laps: Option, - pub r#event_group: Option, - pub r#trigger: Option, - pub r#nec_lat: Option, - pub r#nec_long: Option, - pub r#swc_lat: Option, - pub r#swc_long: Option, - pub r#num_lengths: Option, - pub r#normalized_power: Option, - pub r#training_stress_score: Option, - pub r#intensity_factor: Option, - pub r#left_right_balance: Option, - pub r#end_position_lat: Option, - pub r#end_position_long: Option, - pub r#avg_stroke_count: Option, - pub r#avg_stroke_distance: Option, - pub r#swim_stroke: Option, - pub r#pool_length: Option, - pub r#threshold_power: Option, - pub r#pool_length_unit: Option, - pub r#num_active_lengths: Option, - pub r#total_work: Option, - pub r#avg_altitude: Option, - pub r#max_altitude: Option, - pub r#gps_accuracy: Option, - pub r#avg_grade: Option, - pub r#avg_pos_grade: Option, - pub r#avg_neg_grade: Option, - pub r#max_pos_grade: Option, - pub r#max_neg_grade: Option, - pub r#avg_temperature: Option, - pub r#max_temperature: Option, - pub r#total_moving_time: Option, - pub r#avg_pos_vertical_speed: Option, - pub r#avg_neg_vertical_speed: Option, - pub r#max_pos_vertical_speed: Option, - pub r#max_neg_vertical_speed: Option, - pub r#min_heart_rate: Option, - pub r#time_in_hr_zone: Option, - pub r#time_in_speed_zone: Option, - pub r#time_in_cadence_zone: Option, - pub r#time_in_power_zone: Option, - pub r#avg_lap_time: Option, - pub r#best_lap_index: Option, - pub r#min_altitude: Option, - pub r#player_score: Option, - pub r#opponent_score: Option, - pub r#opponent_name: Option, - pub r#stroke_count: Option, - pub r#zone_count: Option, - pub r#max_ball_speed: Option, - pub r#avg_ball_speed: Option, - pub r#avg_vertical_oscillation: Option, - pub r#avg_stance_time_percent: Option, - pub r#avg_stance_time: Option, - pub r#avg_fractional_cadence: Option, - pub r#max_fractional_cadence: Option, - pub r#total_fractional_cycles: Option, - pub r#avg_total_hemoglobin_conc: Option, - pub r#min_total_hemoglobin_conc: Option, - pub r#max_total_hemoglobin_conc: Option, - pub r#avg_saturated_hemoglobin_percent: Option, - pub r#min_saturated_hemoglobin_percent: Option, - pub r#max_saturated_hemoglobin_percent: Option, - pub r#avg_left_torque_effectiveness: Option, - pub r#avg_right_torque_effectiveness: Option, - pub r#avg_left_pedal_smoothness: Option, - pub r#avg_right_pedal_smoothness: Option, - pub r#avg_combined_pedal_smoothness: Option, - pub r#sport_profile_name: Option, - pub r#sport_index: Option, - pub r#time_standing: Option, - pub r#stand_count: Option, - pub r#avg_left_pco: Option, - pub r#avg_right_pco: Option, - pub r#avg_left_power_phase: Option, - pub r#avg_left_power_phase_peak: Option, - pub r#avg_right_power_phase: Option, - pub r#avg_right_power_phase_peak: Option, - pub r#avg_power_position: Option, - pub r#max_power_position: Option, - pub r#avg_cadence_position: Option, - pub r#max_cadence_position: Option, - pub r#enhanced_avg_speed: Option, - pub r#enhanced_max_speed: Option, - pub r#enhanced_avg_altitude: Option, - pub r#enhanced_min_altitude: Option, - pub r#enhanced_max_altitude: Option, - pub r#avg_lev_motor_power: Option, - pub r#max_lev_motor_power: Option, - pub r#lev_battery_consumption: Option, - pub r#avg_vertical_ratio: Option, - pub r#avg_stance_time_balance: Option, - pub r#avg_step_length: Option, - pub r#total_anaerobic_training_effect: Option, - pub r#avg_vam: Option, - pub r#avg_depth: Option, - pub r#max_depth: Option, - pub r#surface_interval: Option, - pub r#start_cns: Option, - pub r#end_cns: Option, - pub r#start_n2: Option, - pub r#end_n2: Option, - pub r#avg_respiration_rate: Option, - pub r#max_respiration_rate: Option, - pub r#min_respiration_rate: Option, - pub r#min_temperature: Option, - pub r#o2_toxicity: Option, - pub r#dive_number: Option, - pub r#training_load_peak: Option, - pub r#enhanced_avg_respiration_rate: Option, - pub r#enhanced_max_respiration_rate: Option, - pub r#enhanced_min_respiration_rate: Option, - pub r#total_grit: Option, - pub r#total_flow: Option, - pub r#jump_count: Option, - pub r#avg_grit: Option, - pub r#avg_flow: Option, - pub r#avg_spo2: Option, - pub r#avg_stress: Option, - pub r#sdrr_hrv: Option, - pub r#rmssd_hrv: Option, - pub r#total_fractional_ascent: Option, - pub r#total_fractional_descent: Option, - pub r#avg_core_temperature: Option, - pub r#min_core_temperature: Option, - pub r#max_core_temperature: Option, - pub r#timestamp: Option, - pub r#message_index: Option, + pub r#event: Option, + pub r#event_type: Option, + pub r#start_time: Option, + pub r#start_position_lat: Option, + pub r#start_position_long: Option, + pub r#sport: Option, + pub r#sub_sport: Option, + pub r#total_elapsed_time: Option, + pub r#total_timer_time: Option, + pub r#total_distance: Option, + pub r#total_cycles: Option, + pub r#total_calories: Option, + pub r#total_fat_calories: Option, + pub r#avg_speed: Option, + pub r#max_speed: Option, + pub r#avg_heart_rate: Option, + pub r#max_heart_rate: Option, + pub r#avg_cadence: Option, + pub r#max_cadence: Option, + pub r#avg_power: Option, + pub r#max_power: Option, + pub r#total_ascent: Option, + pub r#total_descent: Option, + pub r#total_training_effect: Option, + pub r#first_lap_index: Option, + pub r#num_laps: Option, + pub r#event_group: Option, + pub r#trigger: Option, + pub r#nec_lat: Option, + pub r#nec_long: Option, + pub r#swc_lat: Option, + pub r#swc_long: Option, + pub r#num_lengths: Option, + pub r#normalized_power: Option, + pub r#training_stress_score: Option, + pub r#intensity_factor: Option, + pub r#left_right_balance: Option, + pub r#end_position_lat: Option, + pub r#end_position_long: Option, + pub r#avg_stroke_count: Option, + pub r#avg_stroke_distance: Option, + pub r#swim_stroke: Option, + pub r#pool_length: Option, + pub r#threshold_power: Option, + pub r#pool_length_unit: Option, + pub r#num_active_lengths: Option, + pub r#total_work: Option, + pub r#avg_altitude: Option, + pub r#max_altitude: Option, + pub r#gps_accuracy: Option, + pub r#avg_grade: Option, + pub r#avg_pos_grade: Option, + pub r#avg_neg_grade: Option, + pub r#max_pos_grade: Option, + pub r#max_neg_grade: Option, + pub r#avg_temperature: Option, + pub r#max_temperature: Option, + pub r#total_moving_time: Option, + pub r#avg_pos_vertical_speed: Option, + pub r#avg_neg_vertical_speed: Option, + pub r#max_pos_vertical_speed: Option, + pub r#max_neg_vertical_speed: Option, + pub r#min_heart_rate: Option, + pub r#time_in_hr_zone: Option, + pub r#time_in_speed_zone: Option, + pub r#time_in_cadence_zone: Option, + pub r#time_in_power_zone: Option, + pub r#avg_lap_time: Option, + pub r#best_lap_index: Option, + pub r#min_altitude: Option, + pub r#player_score: Option, + pub r#opponent_score: Option, + pub r#opponent_name: Option, + pub r#stroke_count: Option, + pub r#zone_count: Option, + pub r#max_ball_speed: Option, + pub r#avg_ball_speed: Option, + pub r#avg_vertical_oscillation: Option, + pub r#avg_stance_time_percent: Option, + pub r#avg_stance_time: Option, + pub r#avg_fractional_cadence: Option, + pub r#max_fractional_cadence: Option, + pub r#total_fractional_cycles: Option, + pub r#avg_total_hemoglobin_conc: Option, + pub r#min_total_hemoglobin_conc: Option, + pub r#max_total_hemoglobin_conc: Option, + pub r#avg_saturated_hemoglobin_percent: Option, + pub r#min_saturated_hemoglobin_percent: Option, + pub r#max_saturated_hemoglobin_percent: Option, + pub r#avg_left_torque_effectiveness: Option, + pub r#avg_right_torque_effectiveness: Option, + pub r#avg_left_pedal_smoothness: Option, + pub r#avg_right_pedal_smoothness: Option, + pub r#avg_combined_pedal_smoothness: Option, + pub r#sport_profile_name: Option, + pub r#sport_index: Option, + pub r#time_standing: Option, + pub r#stand_count: Option, + pub r#avg_left_pco: Option, + pub r#avg_right_pco: Option, + pub r#avg_left_power_phase: Option, + pub r#avg_left_power_phase_peak: Option, + pub r#avg_right_power_phase: Option, + pub r#avg_right_power_phase_peak: Option, + pub r#avg_power_position: Option, + pub r#max_power_position: Option, + pub r#avg_cadence_position: Option, + pub r#max_cadence_position: Option, + pub r#enhanced_avg_speed: Option, + pub r#enhanced_max_speed: Option, + pub r#enhanced_avg_altitude: Option, + pub r#enhanced_min_altitude: Option, + pub r#enhanced_max_altitude: Option, + pub r#avg_lev_motor_power: Option, + pub r#max_lev_motor_power: Option, + pub r#lev_battery_consumption: Option, + pub r#avg_vertical_ratio: Option, + pub r#avg_stance_time_balance: Option, + pub r#avg_step_length: Option, + pub r#total_anaerobic_training_effect: Option, + pub r#avg_vam: Option, + pub r#avg_depth: Option, + pub r#max_depth: Option, + pub r#surface_interval: Option, + pub r#start_cns: Option, + pub r#end_cns: Option, + pub r#start_n2: Option, + pub r#end_n2: Option, + pub r#avg_respiration_rate: Option, + pub r#max_respiration_rate: Option, + pub r#min_respiration_rate: Option, + pub r#min_temperature: Option, + pub r#o2_toxicity: Option, + pub r#dive_number: Option, + pub r#training_load_peak: Option, + pub r#enhanced_avg_respiration_rate: Option, + pub r#enhanced_max_respiration_rate: Option, + pub r#enhanced_min_respiration_rate: Option, + pub r#total_grit: Option, + pub r#total_flow: Option, + pub r#jump_count: Option, + pub r#avg_grit: Option, + pub r#avg_flow: Option, + pub r#avg_spo2: Option, + pub r#avg_stress: Option, + pub r#sdrr_hrv: Option, + pub r#rmssd_hrv: Option, + pub r#total_fractional_ascent: Option, + pub r#total_fractional_descent: Option, + pub r#avg_core_temperature: Option, + pub r#min_core_temperature: Option, + pub r#max_core_temperature: Option, + pub r#timestamp: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Session { const NAME: &'static str = "Session"; @@ -3447,470 +5216,1242 @@ impl FitMessage for Session { let mut r#max_core_temperature = None; let mut r#timestamp = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#event = Some(field.into_value()); - } - 1u8 => { - r#event_type = Some(field.into_value()); - } - 2u8 => { - r#start_time = Some(field.into_value()); - } - 3u8 => { - r#start_position_lat = Some(field.into_value()); - } - 4u8 => { - r#start_position_long = Some(field.into_value()); - } - 5u8 => { - r#sport = Some(field.into_value()); - } - 6u8 => { - r#sub_sport = Some(field.into_value()); - } - 7u8 => { - r#total_elapsed_time = Some(field.into_value()); - } - 8u8 => { - r#total_timer_time = Some(field.into_value()); - } - 9u8 => { - r#total_distance = Some(field.into_value()); - } - 10u8 => { - r#total_cycles = Some(field.into_value()); - } - 11u8 => { - r#total_calories = Some(field.into_value()); - } - 13u8 => { - r#total_fat_calories = Some(field.into_value()); - } - 14u8 => { - r#avg_speed = Some(field.into_value()); - } - 15u8 => { - r#max_speed = Some(field.into_value()); - } - 16u8 => { - r#avg_heart_rate = Some(field.into_value()); - } - 17u8 => { - r#max_heart_rate = Some(field.into_value()); - } - 18u8 => { - r#avg_cadence = Some(field.into_value()); - } - 19u8 => { - r#max_cadence = Some(field.into_value()); - } - 20u8 => { - r#avg_power = Some(field.into_value()); - } - 21u8 => { - r#max_power = Some(field.into_value()); - } - 22u8 => { - r#total_ascent = Some(field.into_value()); - } - 23u8 => { - r#total_descent = Some(field.into_value()); - } - 24u8 => { - r#total_training_effect = Some(field.into_value()); - } - 25u8 => { - r#first_lap_index = Some(field.into_value()); - } - 26u8 => { - r#num_laps = Some(field.into_value()); - } - 27u8 => { - r#event_group = Some(field.into_value()); - } - 28u8 => { - r#trigger = Some(field.into_value()); - } - 29u8 => { - r#nec_lat = Some(field.into_value()); - } - 30u8 => { - r#nec_long = Some(field.into_value()); - } - 31u8 => { - r#swc_lat = Some(field.into_value()); - } - 32u8 => { - r#swc_long = Some(field.into_value()); - } - 33u8 => { - r#num_lengths = Some(field.into_value()); - } - 34u8 => { - r#normalized_power = Some(field.into_value()); - } - 35u8 => { - r#training_stress_score = Some(field.into_value()); - } - 36u8 => { - r#intensity_factor = Some(field.into_value()); - } - 37u8 => { - r#left_right_balance = Some(field.into_value()); - } - 38u8 => { - r#end_position_lat = Some(field.into_value()); - } - 39u8 => { - r#end_position_long = Some(field.into_value()); - } - 41u8 => { - r#avg_stroke_count = Some(field.into_value()); - } - 42u8 => { - r#avg_stroke_distance = Some(field.into_value()); - } - 43u8 => { - r#swim_stroke = Some(field.into_value()); - } - 44u8 => { - r#pool_length = Some(field.into_value()); - } - 45u8 => { - r#threshold_power = Some(field.into_value()); - } - 46u8 => { - r#pool_length_unit = Some(field.into_value()); - } - 47u8 => { - r#num_active_lengths = Some(field.into_value()); - } - 48u8 => { - r#total_work = Some(field.into_value()); - } - 49u8 => { - r#avg_altitude = Some(field.into_value()); - } - 50u8 => { - r#max_altitude = Some(field.into_value()); - } - 51u8 => { - r#gps_accuracy = Some(field.into_value()); - } - 52u8 => { - r#avg_grade = Some(field.into_value()); - } - 53u8 => { - r#avg_pos_grade = Some(field.into_value()); - } - 54u8 => { - r#avg_neg_grade = Some(field.into_value()); - } - 55u8 => { - r#max_pos_grade = Some(field.into_value()); - } - 56u8 => { - r#max_neg_grade = Some(field.into_value()); - } - 57u8 => { - r#avg_temperature = Some(field.into_value()); - } - 58u8 => { - r#max_temperature = Some(field.into_value()); - } - 59u8 => { - r#total_moving_time = Some(field.into_value()); - } - 60u8 => { - r#avg_pos_vertical_speed = Some(field.into_value()); - } - 61u8 => { - r#avg_neg_vertical_speed = Some(field.into_value()); - } - 62u8 => { - r#max_pos_vertical_speed = Some(field.into_value()); - } - 63u8 => { - r#max_neg_vertical_speed = Some(field.into_value()); - } - 64u8 => { - r#min_heart_rate = Some(field.into_value()); - } - 65u8 => { - r#time_in_hr_zone = Some(field.into_value()); - } - 66u8 => { - r#time_in_speed_zone = Some(field.into_value()); - } - 67u8 => { - r#time_in_cadence_zone = Some(field.into_value()); - } - 68u8 => { - r#time_in_power_zone = Some(field.into_value()); - } - 69u8 => { - r#avg_lap_time = Some(field.into_value()); - } - 70u8 => { - r#best_lap_index = Some(field.into_value()); - } - 71u8 => { - r#min_altitude = Some(field.into_value()); - } - 82u8 => { - r#player_score = Some(field.into_value()); - } - 83u8 => { - r#opponent_score = Some(field.into_value()); - } - 84u8 => { - r#opponent_name = Some(field.into_value()); - } - 85u8 => { - r#stroke_count = Some(field.into_value()); - } - 86u8 => { - r#zone_count = Some(field.into_value()); - } - 87u8 => { - r#max_ball_speed = Some(field.into_value()); - } - 88u8 => { - r#avg_ball_speed = Some(field.into_value()); - } - 89u8 => { - r#avg_vertical_oscillation = Some(field.into_value()); - } - 90u8 => { - r#avg_stance_time_percent = Some(field.into_value()); - } - 91u8 => { - r#avg_stance_time = Some(field.into_value()); - } - 92u8 => { - r#avg_fractional_cadence = Some(field.into_value()); - } - 93u8 => { - r#max_fractional_cadence = Some(field.into_value()); - } - 94u8 => { - r#total_fractional_cycles = Some(field.into_value()); - } - 95u8 => { - r#avg_total_hemoglobin_conc = Some(field.into_value()); - } - 96u8 => { - r#min_total_hemoglobin_conc = Some(field.into_value()); - } - 97u8 => { - r#max_total_hemoglobin_conc = Some(field.into_value()); - } - 98u8 => { - r#avg_saturated_hemoglobin_percent = Some(field.into_value()); - } - 99u8 => { - r#min_saturated_hemoglobin_percent = Some(field.into_value()); - } - 100u8 => { - r#max_saturated_hemoglobin_percent = Some(field.into_value()); - } - 101u8 => { - r#avg_left_torque_effectiveness = Some(field.into_value()); - } - 102u8 => { - r#avg_right_torque_effectiveness = Some(field.into_value()); - } - 103u8 => { - r#avg_left_pedal_smoothness = Some(field.into_value()); - } - 104u8 => { - r#avg_right_pedal_smoothness = Some(field.into_value()); - } - 105u8 => { - r#avg_combined_pedal_smoothness = Some(field.into_value()); - } - 110u8 => { - r#sport_profile_name = Some(field.into_value()); - } - 111u8 => { - r#sport_index = Some(field.into_value()); - } - 112u8 => { - r#time_standing = Some(field.into_value()); - } - 113u8 => { - r#stand_count = Some(field.into_value()); - } - 114u8 => { - r#avg_left_pco = Some(field.into_value()); - } - 115u8 => { - r#avg_right_pco = Some(field.into_value()); - } - 116u8 => { - r#avg_left_power_phase = Some(field.into_value()); - } - 117u8 => { - r#avg_left_power_phase_peak = Some(field.into_value()); - } - 118u8 => { - r#avg_right_power_phase = Some(field.into_value()); - } - 119u8 => { - r#avg_right_power_phase_peak = Some(field.into_value()); - } - 120u8 => { - r#avg_power_position = Some(field.into_value()); - } - 121u8 => { - r#max_power_position = Some(field.into_value()); - } - 122u8 => { - r#avg_cadence_position = Some(field.into_value()); - } - 123u8 => { - r#max_cadence_position = Some(field.into_value()); - } - 124u8 => { - r#enhanced_avg_speed = Some(field.into_value()); - } - 125u8 => { - r#enhanced_max_speed = Some(field.into_value()); - } - 126u8 => { - r#enhanced_avg_altitude = Some(field.into_value()); - } - 127u8 => { - r#enhanced_min_altitude = Some(field.into_value()); - } - 128u8 => { - r#enhanced_max_altitude = Some(field.into_value()); - } - 129u8 => { - r#avg_lev_motor_power = Some(field.into_value()); - } - 130u8 => { - r#max_lev_motor_power = Some(field.into_value()); - } - 131u8 => { - r#lev_battery_consumption = Some(field.into_value()); - } - 132u8 => { - r#avg_vertical_ratio = Some(field.into_value()); - } - 133u8 => { - r#avg_stance_time_balance = Some(field.into_value()); - } - 134u8 => { - r#avg_step_length = Some(field.into_value()); - } - 137u8 => { - r#total_anaerobic_training_effect = Some(field.into_value()); - } - 139u8 => { - r#avg_vam = Some(field.into_value()); - } - 140u8 => { - r#avg_depth = Some(field.into_value()); - } - 141u8 => { - r#max_depth = Some(field.into_value()); - } - 142u8 => { - r#surface_interval = Some(field.into_value()); - } - 143u8 => { - r#start_cns = Some(field.into_value()); - } - 144u8 => { - r#end_cns = Some(field.into_value()); - } - 145u8 => { - r#start_n2 = Some(field.into_value()); - } - 146u8 => { - r#end_n2 = Some(field.into_value()); - } - 147u8 => { - r#avg_respiration_rate = Some(field.into_value()); - } - 148u8 => { - r#max_respiration_rate = Some(field.into_value()); - } - 149u8 => { - r#min_respiration_rate = Some(field.into_value()); - } - 150u8 => { - r#min_temperature = Some(field.into_value()); - } - 155u8 => { - r#o2_toxicity = Some(field.into_value()); - } - 156u8 => { - r#dive_number = Some(field.into_value()); - } - 168u8 => { - r#training_load_peak = Some(field.into_value()); - } - 169u8 => { - r#enhanced_avg_respiration_rate = Some(field.into_value()); - } - 170u8 => { - r#enhanced_max_respiration_rate = Some(field.into_value()); - } - 180u8 => { - r#enhanced_min_respiration_rate = Some(field.into_value()); - } - 181u8 => { - r#total_grit = Some(field.into_value()); - } - 182u8 => { - r#total_flow = Some(field.into_value()); - } - 183u8 => { - r#jump_count = Some(field.into_value()); - } - 186u8 => { - r#avg_grit = Some(field.into_value()); - } - 187u8 => { - r#avg_flow = Some(field.into_value()); - } - 194u8 => { - r#avg_spo2 = Some(field.into_value()); - } - 195u8 => { - r#avg_stress = Some(field.into_value()); - } - 197u8 => { - r#sdrr_hrv = Some(field.into_value()); - } - 198u8 => { - r#rmssd_hrv = Some(field.into_value()); - } - 199u8 => { - r#total_fractional_ascent = Some(field.into_value()); - } - 200u8 => { - r#total_fractional_descent = Some(field.into_value()); - } - 208u8 => { - r#avg_core_temperature = Some(field.into_value()); - } - 209u8 => { - r#min_core_temperature = Some(field.into_value()); - } - 210u8 => { - r#max_core_temperature = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event = Some(_value); + } + Err(value) => { + invalid_fields.insert("event", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_type", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_time", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_position_lat", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_position_long", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sub_sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sub_sport", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_elapsed_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_elapsed_time", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_timer_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_timer_time", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_distance", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_cycles = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_cycles", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_calories", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_fat_calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_fat_calories", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_speed", value); + } + }, + 15u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_speed", value); + } + }, + 16u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_heart_rate", value); + } + }, + 17u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_heart_rate", value); + } + }, + 18u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_cadence", value); + } + }, + 19u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_cadence", value); + } + }, + 20u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_power", value); + } + }, + 21u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_power", value); + } + }, + 22u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_ascent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_ascent", value); + } + }, + 23u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_descent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_descent", value); + } + }, + 24u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_training_effect = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_training_effect", value); + } + }, + 25u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#first_lap_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("first_lap_index", value); + } + }, + 26u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#num_laps = Some(_value); + } + Err(value) => { + invalid_fields.insert("num_laps", value); + } + }, + 27u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_group = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_group", value); + } + }, + 28u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#trigger = Some(_value); + } + Err(value) => { + invalid_fields.insert("trigger", value); + } + }, + 29u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#nec_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("nec_lat", value); + } + }, + 30u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#nec_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("nec_long", value); + } + }, + 31u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#swc_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("swc_lat", value); + } + }, + 32u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#swc_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("swc_long", value); + } + }, + 33u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#num_lengths = Some(_value); + } + Err(value) => { + invalid_fields.insert("num_lengths", value); + } + }, + 34u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#normalized_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("normalized_power", value); + } + }, + 35u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#training_stress_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("training_stress_score", value); + } + }, + 36u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#intensity_factor = Some(_value); + } + Err(value) => { + invalid_fields.insert("intensity_factor", value); + } + }, + 37u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#left_right_balance = Some(_value); + } + Err(value) => { + invalid_fields.insert("left_right_balance", value); + } + }, + 38u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_position_lat", value); + } + }, + 39u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_position_long", value); + } + }, + 41u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_stroke_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_stroke_count", value); + } + }, + 42u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_stroke_distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_stroke_distance", value); + } + }, + 43u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#swim_stroke = Some(_value); + } + Err(value) => { + invalid_fields.insert("swim_stroke", value); + } + }, + 44u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pool_length = Some(_value); + } + Err(value) => { + invalid_fields.insert("pool_length", value); + } + }, + 45u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#threshold_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("threshold_power", value); + } + }, + 46u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pool_length_unit = Some(_value); + } + Err(value) => { + invalid_fields.insert("pool_length_unit", value); + } + }, + 47u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#num_active_lengths = Some(_value); + } + Err(value) => { + invalid_fields.insert("num_active_lengths", value); + } + }, + 48u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_work = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_work", value); + } + }, + 49u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_altitude", value); + } + }, + 50u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_altitude", value); + } + }, + 51u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gps_accuracy = Some(_value); + } + Err(value) => { + invalid_fields.insert("gps_accuracy", value); + } + }, + 52u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_grade", value); + } + }, + 53u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_pos_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_pos_grade", value); + } + }, + 54u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_neg_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_neg_grade", value); + } + }, + 55u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_pos_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_pos_grade", value); + } + }, + 56u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_neg_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_neg_grade", value); + } + }, + 57u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_temperature", value); + } + }, + 58u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_temperature", value); + } + }, + 59u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_moving_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_moving_time", value); + } + }, + 60u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_pos_vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_pos_vertical_speed", value); + } + }, + 61u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_neg_vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_neg_vertical_speed", value); + } + }, + 62u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_pos_vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_pos_vertical_speed", value); + } + }, + 63u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_neg_vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_neg_vertical_speed", value); + } + }, + 64u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_heart_rate", value); + } + }, + 65u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_hr_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_hr_zone", value); + } + }, + 66u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_speed_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_speed_zone", value); + } + }, + 67u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_cadence_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_cadence_zone", value); + } + }, + 68u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_power_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_power_zone", value); + } + }, + 69u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_lap_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_lap_time", value); + } + }, + 70u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#best_lap_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("best_lap_index", value); + } + }, + 71u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_altitude", value); + } + }, + 82u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#player_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("player_score", value); + } + }, + 83u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#opponent_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("opponent_score", value); + } + }, + 84u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#opponent_name = Some(_value); + } + Err(value) => { + invalid_fields.insert("opponent_name", value); + } + }, + 85u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stroke_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("stroke_count", value); + } + }, + 86u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#zone_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("zone_count", value); + } + }, + 87u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_ball_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_ball_speed", value); + } + }, + 88u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_ball_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_ball_speed", value); + } + }, + 89u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_vertical_oscillation = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_vertical_oscillation", value); + } + }, + 90u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_stance_time_percent = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_stance_time_percent", value); + } + }, + 91u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_stance_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_stance_time", value); + } + }, + 92u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_fractional_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_fractional_cadence", value); + } + }, + 93u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_fractional_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_fractional_cadence", value); + } + }, + 94u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_fractional_cycles = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_fractional_cycles", value); + } + }, + 95u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_total_hemoglobin_conc = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_total_hemoglobin_conc", value); + } + }, + 96u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_total_hemoglobin_conc = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_total_hemoglobin_conc", value); + } + }, + 97u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_total_hemoglobin_conc = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_total_hemoglobin_conc", value); + } + }, + 98u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_saturated_hemoglobin_percent = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_saturated_hemoglobin_percent", value); + } + }, + 99u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_saturated_hemoglobin_percent = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_saturated_hemoglobin_percent", value); + } + }, + 100u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_saturated_hemoglobin_percent = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_saturated_hemoglobin_percent", value); + } + }, + 101u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_torque_effectiveness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_torque_effectiveness", value); + } + }, + 102u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_torque_effectiveness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_torque_effectiveness", value); + } + }, + 103u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_pedal_smoothness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_pedal_smoothness", value); + } + }, + 104u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_pedal_smoothness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_pedal_smoothness", value); + } + }, + 105u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_combined_pedal_smoothness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_combined_pedal_smoothness", value); + } + }, + 110u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport_profile_name = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport_profile_name", value); + } + }, + 111u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport_index", value); + } + }, + 112u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_standing = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_standing", value); + } + }, + 113u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stand_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("stand_count", value); + } + }, + 114u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_pco = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_pco", value); + } + }, + 115u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_pco = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_pco", value); + } + }, + 116u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_power_phase = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_power_phase", value); + } + }, + 117u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_power_phase_peak = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_power_phase_peak", value); + } + }, + 118u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_power_phase = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_power_phase", value); + } + }, + 119u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_power_phase_peak = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_power_phase_peak", value); + } + }, + 120u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_power_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_power_position", value); + } + }, + 121u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_power_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_power_position", value); + } + }, + 122u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_cadence_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_cadence_position", value); + } + }, + 123u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_cadence_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_cadence_position", value); + } + }, + 124u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_avg_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_avg_speed", value); + } + }, + 125u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_max_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_max_speed", value); + } + }, + 126u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_avg_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_avg_altitude", value); + } + }, + 127u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_min_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_min_altitude", value); + } + }, + 128u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_max_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_max_altitude", value); + } + }, + 129u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_lev_motor_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_lev_motor_power", value); + } + }, + 130u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_lev_motor_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_lev_motor_power", value); + } + }, + 131u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#lev_battery_consumption = Some(_value); + } + Err(value) => { + invalid_fields.insert("lev_battery_consumption", value); + } + }, + 132u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_vertical_ratio = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_vertical_ratio", value); + } + }, + 133u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_stance_time_balance = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_stance_time_balance", value); + } + }, + 134u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_step_length = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_step_length", value); + } + }, + 137u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_anaerobic_training_effect = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_anaerobic_training_effect", value); + } + }, + 139u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_vam = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_vam", value); + } + }, + 140u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_depth", value); + } + }, + 141u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_depth", value); + } + }, + 142u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#surface_interval = Some(_value); + } + Err(value) => { + invalid_fields.insert("surface_interval", value); + } + }, + 143u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_cns = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_cns", value); + } + }, + 144u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_cns = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_cns", value); + } + }, + 145u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_n2 = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_n2", value); + } + }, + 146u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_n2 = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_n2", value); + } + }, + 147u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_respiration_rate", value); + } + }, + 148u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_respiration_rate", value); + } + }, + 149u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_respiration_rate", value); + } + }, + 150u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_temperature", value); + } + }, + 155u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#o2_toxicity = Some(_value); + } + Err(value) => { + invalid_fields.insert("o2_toxicity", value); + } + }, + 156u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#dive_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("dive_number", value); + } + }, + 168u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#training_load_peak = Some(_value); + } + Err(value) => { + invalid_fields.insert("training_load_peak", value); + } + }, + 169u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_avg_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_avg_respiration_rate", value); + } + }, + 170u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_max_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_max_respiration_rate", value); + } + }, + 180u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_min_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_min_respiration_rate", value); + } + }, + 181u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_grit = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_grit", value); + } + }, + 182u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_flow = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_flow", value); + } + }, + 183u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#jump_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("jump_count", value); + } + }, + 186u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_grit = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_grit", value); + } + }, + 187u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_flow = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_flow", value); + } + }, + 194u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_spo2 = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_spo2", value); + } + }, + 195u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_stress = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_stress", value); + } + }, + 197u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sdrr_hrv = Some(_value); + } + Err(value) => { + invalid_fields.insert("sdrr_hrv", value); + } + }, + 198u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#rmssd_hrv = Some(_value); + } + Err(value) => { + invalid_fields.insert("rmssd_hrv", value); + } + }, + 199u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_fractional_ascent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_fractional_ascent", value); + } + }, + 200u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_fractional_descent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_fractional_descent", value); + } + }, + 208u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_core_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_core_temperature", value); + } + }, + 209u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_core_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_core_temperature", value); + } + }, + 210u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_core_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_core_temperature", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -4073,8 +6614,12 @@ impl FitMessage for Session { r#max_core_temperature, r#timestamp, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Session { type Error = TryFromRecordError; @@ -4084,129 +6629,130 @@ impl TryFrom for Session { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Lap { - pub r#event: Option, - pub r#event_type: Option, - pub r#start_time: Option, - pub r#start_position_lat: Option, - pub r#start_position_long: Option, - pub r#end_position_lat: Option, - pub r#end_position_long: Option, - pub r#total_elapsed_time: Option, - pub r#total_timer_time: Option, - pub r#total_distance: Option, - pub r#total_cycles: Option, - pub r#total_calories: Option, - pub r#total_fat_calories: Option, - pub r#avg_speed: Option, - pub r#max_speed: Option, - pub r#avg_heart_rate: Option, - pub r#max_heart_rate: Option, - pub r#avg_cadence: Option, - pub r#max_cadence: Option, - pub r#avg_power: Option, - pub r#max_power: Option, - pub r#total_ascent: Option, - pub r#total_descent: Option, - pub r#intensity: Option, - pub r#lap_trigger: Option, - pub r#sport: Option, - pub r#event_group: Option, - pub r#num_lengths: Option, - pub r#normalized_power: Option, - pub r#left_right_balance: Option, - pub r#first_length_index: Option, - pub r#avg_stroke_distance: Option, - pub r#swim_stroke: Option, - pub r#sub_sport: Option, - pub r#num_active_lengths: Option, - pub r#total_work: Option, - pub r#avg_altitude: Option, - pub r#max_altitude: Option, - pub r#gps_accuracy: Option, - pub r#avg_grade: Option, - pub r#avg_pos_grade: Option, - pub r#avg_neg_grade: Option, - pub r#max_pos_grade: Option, - pub r#max_neg_grade: Option, - pub r#avg_temperature: Option, - pub r#max_temperature: Option, - pub r#total_moving_time: Option, - pub r#avg_pos_vertical_speed: Option, - pub r#avg_neg_vertical_speed: Option, - pub r#max_pos_vertical_speed: Option, - pub r#max_neg_vertical_speed: Option, - pub r#time_in_hr_zone: Option, - pub r#time_in_speed_zone: Option, - pub r#time_in_cadence_zone: Option, - pub r#time_in_power_zone: Option, - pub r#repetition_num: Option, - pub r#min_altitude: Option, - pub r#min_heart_rate: Option, - pub r#wkt_step_index: Option, - pub r#opponent_score: Option, - pub r#stroke_count: Option, - pub r#zone_count: Option, - pub r#avg_vertical_oscillation: Option, - pub r#avg_stance_time_percent: Option, - pub r#avg_stance_time: Option, - pub r#avg_fractional_cadence: Option, - pub r#max_fractional_cadence: Option, - pub r#total_fractional_cycles: Option, - pub r#player_score: Option, - pub r#avg_total_hemoglobin_conc: Option, - pub r#min_total_hemoglobin_conc: Option, - pub r#max_total_hemoglobin_conc: Option, - pub r#avg_saturated_hemoglobin_percent: Option, - pub r#min_saturated_hemoglobin_percent: Option, - pub r#max_saturated_hemoglobin_percent: Option, - pub r#avg_left_torque_effectiveness: Option, - pub r#avg_right_torque_effectiveness: Option, - pub r#avg_left_pedal_smoothness: Option, - pub r#avg_right_pedal_smoothness: Option, - pub r#avg_combined_pedal_smoothness: Option, - pub r#time_standing: Option, - pub r#stand_count: Option, - pub r#avg_left_pco: Option, - pub r#avg_right_pco: Option, - pub r#avg_left_power_phase: Option, - pub r#avg_left_power_phase_peak: Option, - pub r#avg_right_power_phase: Option, - pub r#avg_right_power_phase_peak: Option, - pub r#avg_power_position: Option, - pub r#max_power_position: Option, - pub r#avg_cadence_position: Option, - pub r#max_cadence_position: Option, - pub r#enhanced_avg_speed: Option, - pub r#enhanced_max_speed: Option, - pub r#enhanced_avg_altitude: Option, - pub r#enhanced_min_altitude: Option, - pub r#enhanced_max_altitude: Option, - pub r#avg_lev_motor_power: Option, - pub r#max_lev_motor_power: Option, - pub r#lev_battery_consumption: Option, - pub r#avg_vertical_ratio: Option, - pub r#avg_stance_time_balance: Option, - pub r#avg_step_length: Option, - pub r#avg_vam: Option, - pub r#avg_depth: Option, - pub r#max_depth: Option, - pub r#min_temperature: Option, - pub r#enhanced_avg_respiration_rate: Option, - pub r#enhanced_max_respiration_rate: Option, - pub r#avg_respiration_rate: Option, - pub r#max_respiration_rate: Option, - pub r#total_grit: Option, - pub r#total_flow: Option, - pub r#jump_count: Option, - pub r#avg_grit: Option, - pub r#avg_flow: Option, - pub r#total_fractional_ascent: Option, - pub r#total_fractional_descent: Option, - pub r#avg_core_temperature: Option, - pub r#min_core_temperature: Option, - pub r#max_core_temperature: Option, - pub r#timestamp: Option, - pub r#message_index: Option, + pub r#event: Option, + pub r#event_type: Option, + pub r#start_time: Option, + pub r#start_position_lat: Option, + pub r#start_position_long: Option, + pub r#end_position_lat: Option, + pub r#end_position_long: Option, + pub r#total_elapsed_time: Option, + pub r#total_timer_time: Option, + pub r#total_distance: Option, + pub r#total_cycles: Option, + pub r#total_calories: Option, + pub r#total_fat_calories: Option, + pub r#avg_speed: Option, + pub r#max_speed: Option, + pub r#avg_heart_rate: Option, + pub r#max_heart_rate: Option, + pub r#avg_cadence: Option, + pub r#max_cadence: Option, + pub r#avg_power: Option, + pub r#max_power: Option, + pub r#total_ascent: Option, + pub r#total_descent: Option, + pub r#intensity: Option, + pub r#lap_trigger: Option, + pub r#sport: Option, + pub r#event_group: Option, + pub r#num_lengths: Option, + pub r#normalized_power: Option, + pub r#left_right_balance: Option, + pub r#first_length_index: Option, + pub r#avg_stroke_distance: Option, + pub r#swim_stroke: Option, + pub r#sub_sport: Option, + pub r#num_active_lengths: Option, + pub r#total_work: Option, + pub r#avg_altitude: Option, + pub r#max_altitude: Option, + pub r#gps_accuracy: Option, + pub r#avg_grade: Option, + pub r#avg_pos_grade: Option, + pub r#avg_neg_grade: Option, + pub r#max_pos_grade: Option, + pub r#max_neg_grade: Option, + pub r#avg_temperature: Option, + pub r#max_temperature: Option, + pub r#total_moving_time: Option, + pub r#avg_pos_vertical_speed: Option, + pub r#avg_neg_vertical_speed: Option, + pub r#max_pos_vertical_speed: Option, + pub r#max_neg_vertical_speed: Option, + pub r#time_in_hr_zone: Option, + pub r#time_in_speed_zone: Option, + pub r#time_in_cadence_zone: Option, + pub r#time_in_power_zone: Option, + pub r#repetition_num: Option, + pub r#min_altitude: Option, + pub r#min_heart_rate: Option, + pub r#wkt_step_index: Option, + pub r#opponent_score: Option, + pub r#stroke_count: Option, + pub r#zone_count: Option, + pub r#avg_vertical_oscillation: Option, + pub r#avg_stance_time_percent: Option, + pub r#avg_stance_time: Option, + pub r#avg_fractional_cadence: Option, + pub r#max_fractional_cadence: Option, + pub r#total_fractional_cycles: Option, + pub r#player_score: Option, + pub r#avg_total_hemoglobin_conc: Option, + pub r#min_total_hemoglobin_conc: Option, + pub r#max_total_hemoglobin_conc: Option, + pub r#avg_saturated_hemoglobin_percent: Option, + pub r#min_saturated_hemoglobin_percent: Option, + pub r#max_saturated_hemoglobin_percent: Option, + pub r#avg_left_torque_effectiveness: Option, + pub r#avg_right_torque_effectiveness: Option, + pub r#avg_left_pedal_smoothness: Option, + pub r#avg_right_pedal_smoothness: Option, + pub r#avg_combined_pedal_smoothness: Option, + pub r#time_standing: Option, + pub r#stand_count: Option, + pub r#avg_left_pco: Option, + pub r#avg_right_pco: Option, + pub r#avg_left_power_phase: Option, + pub r#avg_left_power_phase_peak: Option, + pub r#avg_right_power_phase: Option, + pub r#avg_right_power_phase_peak: Option, + pub r#avg_power_position: Option, + pub r#max_power_position: Option, + pub r#avg_cadence_position: Option, + pub r#max_cadence_position: Option, + pub r#enhanced_avg_speed: Option, + pub r#enhanced_max_speed: Option, + pub r#enhanced_avg_altitude: Option, + pub r#enhanced_min_altitude: Option, + pub r#enhanced_max_altitude: Option, + pub r#avg_lev_motor_power: Option, + pub r#max_lev_motor_power: Option, + pub r#lev_battery_consumption: Option, + pub r#avg_vertical_ratio: Option, + pub r#avg_stance_time_balance: Option, + pub r#avg_step_length: Option, + pub r#avg_vam: Option, + pub r#avg_depth: Option, + pub r#max_depth: Option, + pub r#min_temperature: Option, + pub r#enhanced_avg_respiration_rate: Option, + pub r#enhanced_max_respiration_rate: Option, + pub r#avg_respiration_rate: Option, + pub r#max_respiration_rate: Option, + pub r#total_grit: Option, + pub r#total_flow: Option, + pub r#jump_count: Option, + pub r#avg_grit: Option, + pub r#avg_flow: Option, + pub r#total_fractional_ascent: Option, + pub r#total_fractional_descent: Option, + pub r#avg_core_temperature: Option, + pub r#min_core_temperature: Option, + pub r#max_core_temperature: Option, + pub r#timestamp: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Lap { const NAME: &'static str = "Lap"; @@ -4341,377 +6887,994 @@ impl FitMessage for Lap { let mut r#max_core_temperature = None; let mut r#timestamp = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#event = Some(field.into_value()); - } - 1u8 => { - r#event_type = Some(field.into_value()); - } - 2u8 => { - r#start_time = Some(field.into_value()); - } - 3u8 => { - r#start_position_lat = Some(field.into_value()); - } - 4u8 => { - r#start_position_long = Some(field.into_value()); - } - 5u8 => { - r#end_position_lat = Some(field.into_value()); - } - 6u8 => { - r#end_position_long = Some(field.into_value()); - } - 7u8 => { - r#total_elapsed_time = Some(field.into_value()); - } - 8u8 => { - r#total_timer_time = Some(field.into_value()); - } - 9u8 => { - r#total_distance = Some(field.into_value()); - } - 10u8 => { - r#total_cycles = Some(field.into_value()); - } - 11u8 => { - r#total_calories = Some(field.into_value()); - } - 12u8 => { - r#total_fat_calories = Some(field.into_value()); - } - 13u8 => { - r#avg_speed = Some(field.into_value()); - } - 14u8 => { - r#max_speed = Some(field.into_value()); - } - 15u8 => { - r#avg_heart_rate = Some(field.into_value()); - } - 16u8 => { - r#max_heart_rate = Some(field.into_value()); - } - 17u8 => { - r#avg_cadence = Some(field.into_value()); - } - 18u8 => { - r#max_cadence = Some(field.into_value()); - } - 19u8 => { - r#avg_power = Some(field.into_value()); - } - 20u8 => { - r#max_power = Some(field.into_value()); - } - 21u8 => { - r#total_ascent = Some(field.into_value()); - } - 22u8 => { - r#total_descent = Some(field.into_value()); - } - 23u8 => { - r#intensity = Some(field.into_value()); - } - 24u8 => { - r#lap_trigger = Some(field.into_value()); - } - 25u8 => { - r#sport = Some(field.into_value()); - } - 26u8 => { - r#event_group = Some(field.into_value()); - } - 32u8 => { - r#num_lengths = Some(field.into_value()); - } - 33u8 => { - r#normalized_power = Some(field.into_value()); - } - 34u8 => { - r#left_right_balance = Some(field.into_value()); - } - 35u8 => { - r#first_length_index = Some(field.into_value()); - } - 37u8 => { - r#avg_stroke_distance = Some(field.into_value()); - } - 38u8 => { - r#swim_stroke = Some(field.into_value()); - } - 39u8 => { - r#sub_sport = Some(field.into_value()); - } - 40u8 => { - r#num_active_lengths = Some(field.into_value()); - } - 41u8 => { - r#total_work = Some(field.into_value()); - } - 42u8 => { - r#avg_altitude = Some(field.into_value()); - } - 43u8 => { - r#max_altitude = Some(field.into_value()); - } - 44u8 => { - r#gps_accuracy = Some(field.into_value()); - } - 45u8 => { - r#avg_grade = Some(field.into_value()); - } - 46u8 => { - r#avg_pos_grade = Some(field.into_value()); - } - 47u8 => { - r#avg_neg_grade = Some(field.into_value()); - } - 48u8 => { - r#max_pos_grade = Some(field.into_value()); - } - 49u8 => { - r#max_neg_grade = Some(field.into_value()); - } - 50u8 => { - r#avg_temperature = Some(field.into_value()); - } - 51u8 => { - r#max_temperature = Some(field.into_value()); - } - 52u8 => { - r#total_moving_time = Some(field.into_value()); - } - 53u8 => { - r#avg_pos_vertical_speed = Some(field.into_value()); - } - 54u8 => { - r#avg_neg_vertical_speed = Some(field.into_value()); - } - 55u8 => { - r#max_pos_vertical_speed = Some(field.into_value()); - } - 56u8 => { - r#max_neg_vertical_speed = Some(field.into_value()); - } - 57u8 => { - r#time_in_hr_zone = Some(field.into_value()); - } - 58u8 => { - r#time_in_speed_zone = Some(field.into_value()); - } - 59u8 => { - r#time_in_cadence_zone = Some(field.into_value()); - } - 60u8 => { - r#time_in_power_zone = Some(field.into_value()); - } - 61u8 => { - r#repetition_num = Some(field.into_value()); - } - 62u8 => { - r#min_altitude = Some(field.into_value()); - } - 63u8 => { - r#min_heart_rate = Some(field.into_value()); - } - 71u8 => { - r#wkt_step_index = Some(field.into_value()); - } - 74u8 => { - r#opponent_score = Some(field.into_value()); - } - 75u8 => { - r#stroke_count = Some(field.into_value()); - } - 76u8 => { - r#zone_count = Some(field.into_value()); - } - 77u8 => { - r#avg_vertical_oscillation = Some(field.into_value()); - } - 78u8 => { - r#avg_stance_time_percent = Some(field.into_value()); - } - 79u8 => { - r#avg_stance_time = Some(field.into_value()); - } - 80u8 => { - r#avg_fractional_cadence = Some(field.into_value()); - } - 81u8 => { - r#max_fractional_cadence = Some(field.into_value()); - } - 82u8 => { - r#total_fractional_cycles = Some(field.into_value()); - } - 83u8 => { - r#player_score = Some(field.into_value()); - } - 84u8 => { - r#avg_total_hemoglobin_conc = Some(field.into_value()); - } - 85u8 => { - r#min_total_hemoglobin_conc = Some(field.into_value()); - } - 86u8 => { - r#max_total_hemoglobin_conc = Some(field.into_value()); - } - 87u8 => { - r#avg_saturated_hemoglobin_percent = Some(field.into_value()); - } - 88u8 => { - r#min_saturated_hemoglobin_percent = Some(field.into_value()); - } - 89u8 => { - r#max_saturated_hemoglobin_percent = Some(field.into_value()); - } - 91u8 => { - r#avg_left_torque_effectiveness = Some(field.into_value()); - } - 92u8 => { - r#avg_right_torque_effectiveness = Some(field.into_value()); - } - 93u8 => { - r#avg_left_pedal_smoothness = Some(field.into_value()); - } - 94u8 => { - r#avg_right_pedal_smoothness = Some(field.into_value()); - } - 95u8 => { - r#avg_combined_pedal_smoothness = Some(field.into_value()); - } - 98u8 => { - r#time_standing = Some(field.into_value()); - } - 99u8 => { - r#stand_count = Some(field.into_value()); - } - 100u8 => { - r#avg_left_pco = Some(field.into_value()); - } - 101u8 => { - r#avg_right_pco = Some(field.into_value()); - } - 102u8 => { - r#avg_left_power_phase = Some(field.into_value()); - } - 103u8 => { - r#avg_left_power_phase_peak = Some(field.into_value()); - } - 104u8 => { - r#avg_right_power_phase = Some(field.into_value()); - } - 105u8 => { - r#avg_right_power_phase_peak = Some(field.into_value()); - } - 106u8 => { - r#avg_power_position = Some(field.into_value()); - } - 107u8 => { - r#max_power_position = Some(field.into_value()); - } - 108u8 => { - r#avg_cadence_position = Some(field.into_value()); - } - 109u8 => { - r#max_cadence_position = Some(field.into_value()); - } - 110u8 => { - r#enhanced_avg_speed = Some(field.into_value()); - } - 111u8 => { - r#enhanced_max_speed = Some(field.into_value()); - } - 112u8 => { - r#enhanced_avg_altitude = Some(field.into_value()); - } - 113u8 => { - r#enhanced_min_altitude = Some(field.into_value()); - } - 114u8 => { - r#enhanced_max_altitude = Some(field.into_value()); - } - 115u8 => { - r#avg_lev_motor_power = Some(field.into_value()); - } - 116u8 => { - r#max_lev_motor_power = Some(field.into_value()); - } - 117u8 => { - r#lev_battery_consumption = Some(field.into_value()); - } - 118u8 => { - r#avg_vertical_ratio = Some(field.into_value()); - } - 119u8 => { - r#avg_stance_time_balance = Some(field.into_value()); - } - 120u8 => { - r#avg_step_length = Some(field.into_value()); - } - 121u8 => { - r#avg_vam = Some(field.into_value()); - } - 122u8 => { - r#avg_depth = Some(field.into_value()); - } - 123u8 => { - r#max_depth = Some(field.into_value()); - } - 124u8 => { - r#min_temperature = Some(field.into_value()); - } - 136u8 => { - r#enhanced_avg_respiration_rate = Some(field.into_value()); - } - 137u8 => { - r#enhanced_max_respiration_rate = Some(field.into_value()); - } - 147u8 => { - r#avg_respiration_rate = Some(field.into_value()); - } - 148u8 => { - r#max_respiration_rate = Some(field.into_value()); - } - 149u8 => { - r#total_grit = Some(field.into_value()); - } - 150u8 => { - r#total_flow = Some(field.into_value()); - } - 151u8 => { - r#jump_count = Some(field.into_value()); - } - 153u8 => { - r#avg_grit = Some(field.into_value()); - } - 154u8 => { - r#avg_flow = Some(field.into_value()); - } - 156u8 => { - r#total_fractional_ascent = Some(field.into_value()); - } - 157u8 => { - r#total_fractional_descent = Some(field.into_value()); - } - 158u8 => { - r#avg_core_temperature = Some(field.into_value()); - } - 159u8 => { - r#min_core_temperature = Some(field.into_value()); - } - 160u8 => { - r#max_core_temperature = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event = Some(_value); + } + Err(value) => { + invalid_fields.insert("event", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_type", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_time", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_position_lat", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_position_long", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_position_lat", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_position_long", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_elapsed_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_elapsed_time", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_timer_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_timer_time", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_distance", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_cycles = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_cycles", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_calories", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_fat_calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_fat_calories", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_speed", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_speed", value); + } + }, + 15u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_heart_rate", value); + } + }, + 16u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_heart_rate", value); + } + }, + 17u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_cadence", value); + } + }, + 18u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_cadence", value); + } + }, + 19u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_power", value); + } + }, + 20u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_power", value); + } + }, + 21u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_ascent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_ascent", value); + } + }, + 22u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_descent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_descent", value); + } + }, + 23u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#intensity = Some(_value); + } + Err(value) => { + invalid_fields.insert("intensity", value); + } + }, + 24u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#lap_trigger = Some(_value); + } + Err(value) => { + invalid_fields.insert("lap_trigger", value); + } + }, + 25u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport", value); + } + }, + 26u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_group = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_group", value); + } + }, + 32u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#num_lengths = Some(_value); + } + Err(value) => { + invalid_fields.insert("num_lengths", value); + } + }, + 33u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#normalized_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("normalized_power", value); + } + }, + 34u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#left_right_balance = Some(_value); + } + Err(value) => { + invalid_fields.insert("left_right_balance", value); + } + }, + 35u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#first_length_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("first_length_index", value); + } + }, + 37u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_stroke_distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_stroke_distance", value); + } + }, + 38u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#swim_stroke = Some(_value); + } + Err(value) => { + invalid_fields.insert("swim_stroke", value); + } + }, + 39u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sub_sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sub_sport", value); + } + }, + 40u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#num_active_lengths = Some(_value); + } + Err(value) => { + invalid_fields.insert("num_active_lengths", value); + } + }, + 41u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_work = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_work", value); + } + }, + 42u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_altitude", value); + } + }, + 43u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_altitude", value); + } + }, + 44u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gps_accuracy = Some(_value); + } + Err(value) => { + invalid_fields.insert("gps_accuracy", value); + } + }, + 45u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_grade", value); + } + }, + 46u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_pos_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_pos_grade", value); + } + }, + 47u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_neg_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_neg_grade", value); + } + }, + 48u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_pos_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_pos_grade", value); + } + }, + 49u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_neg_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_neg_grade", value); + } + }, + 50u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_temperature", value); + } + }, + 51u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_temperature", value); + } + }, + 52u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_moving_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_moving_time", value); + } + }, + 53u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_pos_vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_pos_vertical_speed", value); + } + }, + 54u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_neg_vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_neg_vertical_speed", value); + } + }, + 55u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_pos_vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_pos_vertical_speed", value); + } + }, + 56u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_neg_vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_neg_vertical_speed", value); + } + }, + 57u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_hr_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_hr_zone", value); + } + }, + 58u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_speed_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_speed_zone", value); + } + }, + 59u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_cadence_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_cadence_zone", value); + } + }, + 60u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_power_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_power_zone", value); + } + }, + 61u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#repetition_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("repetition_num", value); + } + }, + 62u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_altitude", value); + } + }, + 63u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_heart_rate", value); + } + }, + 71u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#wkt_step_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("wkt_step_index", value); + } + }, + 74u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#opponent_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("opponent_score", value); + } + }, + 75u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stroke_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("stroke_count", value); + } + }, + 76u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#zone_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("zone_count", value); + } + }, + 77u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_vertical_oscillation = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_vertical_oscillation", value); + } + }, + 78u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_stance_time_percent = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_stance_time_percent", value); + } + }, + 79u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_stance_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_stance_time", value); + } + }, + 80u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_fractional_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_fractional_cadence", value); + } + }, + 81u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_fractional_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_fractional_cadence", value); + } + }, + 82u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_fractional_cycles = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_fractional_cycles", value); + } + }, + 83u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#player_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("player_score", value); + } + }, + 84u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_total_hemoglobin_conc = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_total_hemoglobin_conc", value); + } + }, + 85u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_total_hemoglobin_conc = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_total_hemoglobin_conc", value); + } + }, + 86u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_total_hemoglobin_conc = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_total_hemoglobin_conc", value); + } + }, + 87u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_saturated_hemoglobin_percent = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_saturated_hemoglobin_percent", value); + } + }, + 88u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_saturated_hemoglobin_percent = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_saturated_hemoglobin_percent", value); + } + }, + 89u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_saturated_hemoglobin_percent = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_saturated_hemoglobin_percent", value); + } + }, + 91u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_torque_effectiveness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_torque_effectiveness", value); + } + }, + 92u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_torque_effectiveness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_torque_effectiveness", value); + } + }, + 93u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_pedal_smoothness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_pedal_smoothness", value); + } + }, + 94u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_pedal_smoothness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_pedal_smoothness", value); + } + }, + 95u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_combined_pedal_smoothness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_combined_pedal_smoothness", value); + } + }, + 98u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_standing = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_standing", value); + } + }, + 99u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stand_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("stand_count", value); + } + }, + 100u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_pco = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_pco", value); + } + }, + 101u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_pco = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_pco", value); + } + }, + 102u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_power_phase = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_power_phase", value); + } + }, + 103u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_power_phase_peak = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_power_phase_peak", value); + } + }, + 104u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_power_phase = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_power_phase", value); + } + }, + 105u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_power_phase_peak = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_power_phase_peak", value); + } + }, + 106u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_power_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_power_position", value); + } + }, + 107u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_power_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_power_position", value); + } + }, + 108u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_cadence_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_cadence_position", value); + } + }, + 109u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_cadence_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_cadence_position", value); + } + }, + 110u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_avg_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_avg_speed", value); + } + }, + 111u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_max_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_max_speed", value); + } + }, + 112u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_avg_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_avg_altitude", value); + } + }, + 113u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_min_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_min_altitude", value); + } + }, + 114u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_max_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_max_altitude", value); + } + }, + 115u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_lev_motor_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_lev_motor_power", value); + } + }, + 116u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_lev_motor_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_lev_motor_power", value); + } + }, + 117u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#lev_battery_consumption = Some(_value); + } + Err(value) => { + invalid_fields.insert("lev_battery_consumption", value); + } + }, + 118u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_vertical_ratio = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_vertical_ratio", value); + } + }, + 119u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_stance_time_balance = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_stance_time_balance", value); + } + }, + 120u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_step_length = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_step_length", value); + } + }, + 121u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_vam = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_vam", value); + } + }, + 122u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_depth", value); + } + }, + 123u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_depth", value); + } + }, + 124u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_temperature", value); + } + }, + 136u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_avg_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_avg_respiration_rate", value); + } + }, + 137u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_max_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_max_respiration_rate", value); + } + }, + 147u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_respiration_rate", value); + } + }, + 148u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_respiration_rate", value); + } + }, + 149u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_grit = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_grit", value); + } + }, + 150u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_flow = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_flow", value); + } + }, + 151u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#jump_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("jump_count", value); + } + }, + 153u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_grit = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_grit", value); + } + }, + 154u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_flow = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_flow", value); + } + }, + 156u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_fractional_ascent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_fractional_ascent", value); + } + }, + 157u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_fractional_descent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_fractional_descent", value); + } + }, + 158u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_core_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_core_temperature", value); + } + }, + 159u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_core_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_core_temperature", value); + } + }, + 160u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_core_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_core_temperature", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -4843,8 +8006,12 @@ impl FitMessage for Lap { r#max_core_temperature, r#timestamp, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Lap { type Error = TryFromRecordError; @@ -4854,28 +8021,29 @@ impl TryFrom for Lap { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Length { - pub r#event: Option, - pub r#event_type: Option, - pub r#start_time: Option, - pub r#total_elapsed_time: Option, - pub r#total_timer_time: Option, - pub r#total_strokes: Option, - pub r#avg_speed: Option, - pub r#swim_stroke: Option, - pub r#avg_swimming_cadence: Option, - pub r#event_group: Option, - pub r#total_calories: Option, - pub r#length_type: Option, - pub r#player_score: Option, - pub r#opponent_score: Option, - pub r#stroke_count: Option, - pub r#zone_count: Option, - pub r#enhanced_avg_respiration_rate: Option, - pub r#enhanced_max_respiration_rate: Option, - pub r#avg_respiration_rate: Option, - pub r#max_respiration_rate: Option, - pub r#timestamp: Option, - pub r#message_index: Option, + pub r#event: Option, + pub r#event_type: Option, + pub r#start_time: Option, + pub r#total_elapsed_time: Option, + pub r#total_timer_time: Option, + pub r#total_strokes: Option, + pub r#avg_speed: Option, + pub r#swim_stroke: Option, + pub r#avg_swimming_cadence: Option, + pub r#event_group: Option, + pub r#total_calories: Option, + pub r#length_type: Option, + pub r#player_score: Option, + pub r#opponent_score: Option, + pub r#stroke_count: Option, + pub r#zone_count: Option, + pub r#enhanced_avg_respiration_rate: Option, + pub r#enhanced_max_respiration_rate: Option, + pub r#avg_respiration_rate: Option, + pub r#max_respiration_rate: Option, + pub r#timestamp: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Length { const NAME: &'static str = "Length"; @@ -4908,549 +8076,1088 @@ impl FitMessage for Length { let mut r#avg_respiration_rate = None; let mut r#max_respiration_rate = None; let mut r#timestamp = None; - let mut r#message_index = None; + let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); + for field in record.into_vec() { + match field.number() { + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event = Some(_value); + } + Err(value) => { + invalid_fields.insert("event", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_type", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_time", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_elapsed_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_elapsed_time", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_timer_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_timer_time", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_strokes = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_strokes", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_speed", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#swim_stroke = Some(_value); + } + Err(value) => { + invalid_fields.insert("swim_stroke", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_swimming_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_swimming_cadence", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_group = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_group", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_calories", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#length_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("length_type", value); + } + }, + 18u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#player_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("player_score", value); + } + }, + 19u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#opponent_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("opponent_score", value); + } + }, + 20u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stroke_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("stroke_count", value); + } + }, + 21u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#zone_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("zone_count", value); + } + }, + 22u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_avg_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_avg_respiration_rate", value); + } + }, + 23u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_max_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_max_respiration_rate", value); + } + }, + 24u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_respiration_rate", value); + } + }, + 25u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_respiration_rate", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, + _ => { + if !options.ignore_unexpected_fields { + return Err(TryFromRecordError::unexpected_field(&field)); + } + } + } + } + Ok(Self { + r#event, + r#event_type, + r#start_time, + r#total_elapsed_time, + r#total_timer_time, + r#total_strokes, + r#avg_speed, + r#swim_stroke, + r#avg_swimming_cadence, + r#event_group, + r#total_calories, + r#length_type, + r#player_score, + r#opponent_score, + r#stroke_count, + r#zone_count, + r#enhanced_avg_respiration_rate, + r#enhanced_max_respiration_rate, + r#avg_respiration_rate, + r#max_respiration_rate, + r#timestamp, + r#message_index, + invalid_fields, + }) + } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } +} +impl TryFrom for Length { + type Error = TryFromRecordError; + fn try_from(record: FitDataRecord) -> Result { + Self::parse(record) + } +} +#[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] +pub struct Record { + pub r#position_lat: Option, + pub r#position_long: Option, + pub r#altitude: Option, + pub r#heart_rate: Option, + pub r#cadence: Option, + pub r#distance: Option, + pub r#speed: Option, + pub r#power: Option, + pub r#compressed_speed_distance: Option, + pub r#grade: Option, + pub r#resistance: Option, + pub r#time_from_course: Option, + pub r#cycle_length: Option, + pub r#temperature: Option, + pub r#speed_1s: Option, + pub r#cycles: Option, + pub r#total_cycles: Option, + pub r#compressed_accumulated_power: Option, + pub r#accumulated_power: Option, + pub r#left_right_balance: Option, + pub r#gps_accuracy: Option, + pub r#vertical_speed: Option, + pub r#calories: Option, + pub r#vertical_oscillation: Option, + pub r#stance_time_percent: Option, + pub r#stance_time: Option, + pub r#activity_type: Option, + pub r#left_torque_effectiveness: Option, + pub r#right_torque_effectiveness: Option, + pub r#left_pedal_smoothness: Option, + pub r#right_pedal_smoothness: Option, + pub r#combined_pedal_smoothness: Option, + pub r#time128: Option, + pub r#stroke_type: Option, + pub r#zone: Option, + pub r#ball_speed: Option, + pub r#cadence256: Option, + pub r#fractional_cadence: Option, + pub r#total_hemoglobin_conc: Option, + pub r#total_hemoglobin_conc_min: Option, + pub r#total_hemoglobin_conc_max: Option, + pub r#saturated_hemoglobin_percent: Option, + pub r#saturated_hemoglobin_percent_min: Option, + pub r#saturated_hemoglobin_percent_max: Option, + pub r#device_index: Option, + pub r#left_pco: Option, + pub r#right_pco: Option, + pub r#left_power_phase: Option, + pub r#left_power_phase_peak: Option, + pub r#right_power_phase: Option, + pub r#right_power_phase_peak: Option, + pub r#enhanced_speed: Option, + pub r#enhanced_altitude: Option, + pub r#battery_soc: Option, + pub r#motor_power: Option, + pub r#vertical_ratio: Option, + pub r#stance_time_balance: Option, + pub r#step_length: Option, + pub r#cycle_length16: Option, + pub r#absolute_pressure: Option, + pub r#depth: Option, + pub r#next_stop_depth: Option, + pub r#next_stop_time: Option, + pub r#time_to_surface: Option, + pub r#ndl_time: Option, + pub r#cns_load: Option, + pub r#n2_load: Option, + pub r#respiration_rate: Option, + pub r#enhanced_respiration_rate: Option, + pub r#grit: Option, + pub r#flow: Option, + pub r#current_stress: Option, + pub r#ebike_travel_range: Option, + pub r#ebike_battery_level: Option, + pub r#ebike_assist_mode: Option, + pub r#ebike_assist_level_percent: Option, + pub r#air_time_remaining: Option, + pub r#pressure_sac: Option, + pub r#volume_sac: Option, + pub r#rmv: Option, + pub r#ascent_rate: Option, + pub r#po2: Option, + pub r#core_temperature: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, +} +impl FitMessage for Record { + const NAME: &'static str = "Record"; + const KIND: MesgNum = MesgNum::Record; + fn parse_with_options( + record: FitDataRecord, + options: MessageParseOptions, + ) -> Result { + if record.kind() != Self::KIND { + return Err(TryFromRecordError::unexpected_message_kind::(&record)); + } + let mut r#position_lat = None; + let mut r#position_long = None; + let mut r#altitude = None; + let mut r#heart_rate = None; + let mut r#cadence = None; + let mut r#distance = None; + let mut r#speed = None; + let mut r#power = None; + let mut r#compressed_speed_distance = None; + let mut r#grade = None; + let mut r#resistance = None; + let mut r#time_from_course = None; + let mut r#cycle_length = None; + let mut r#temperature = None; + let mut r#speed_1s = None; + let mut r#cycles = None; + let mut r#total_cycles = None; + let mut r#compressed_accumulated_power = None; + let mut r#accumulated_power = None; + let mut r#left_right_balance = None; + let mut r#gps_accuracy = None; + let mut r#vertical_speed = None; + let mut r#calories = None; + let mut r#vertical_oscillation = None; + let mut r#stance_time_percent = None; + let mut r#stance_time = None; + let mut r#activity_type = None; + let mut r#left_torque_effectiveness = None; + let mut r#right_torque_effectiveness = None; + let mut r#left_pedal_smoothness = None; + let mut r#right_pedal_smoothness = None; + let mut r#combined_pedal_smoothness = None; + let mut r#time128 = None; + let mut r#stroke_type = None; + let mut r#zone = None; + let mut r#ball_speed = None; + let mut r#cadence256 = None; + let mut r#fractional_cadence = None; + let mut r#total_hemoglobin_conc = None; + let mut r#total_hemoglobin_conc_min = None; + let mut r#total_hemoglobin_conc_max = None; + let mut r#saturated_hemoglobin_percent = None; + let mut r#saturated_hemoglobin_percent_min = None; + let mut r#saturated_hemoglobin_percent_max = None; + let mut r#device_index = None; + let mut r#left_pco = None; + let mut r#right_pco = None; + let mut r#left_power_phase = None; + let mut r#left_power_phase_peak = None; + let mut r#right_power_phase = None; + let mut r#right_power_phase_peak = None; + let mut r#enhanced_speed = None; + let mut r#enhanced_altitude = None; + let mut r#battery_soc = None; + let mut r#motor_power = None; + let mut r#vertical_ratio = None; + let mut r#stance_time_balance = None; + let mut r#step_length = None; + let mut r#cycle_length16 = None; + let mut r#absolute_pressure = None; + let mut r#depth = None; + let mut r#next_stop_depth = None; + let mut r#next_stop_time = None; + let mut r#time_to_surface = None; + let mut r#ndl_time = None; + let mut r#cns_load = None; + let mut r#n2_load = None; + let mut r#respiration_rate = None; + let mut r#enhanced_respiration_rate = None; + let mut r#grit = None; + let mut r#flow = None; + let mut r#current_stress = None; + let mut r#ebike_travel_range = None; + let mut r#ebike_battery_level = None; + let mut r#ebike_assist_mode = None; + let mut r#ebike_assist_level_percent = None; + let mut r#air_time_remaining = None; + let mut r#pressure_sac = None; + let mut r#volume_sac = None; + let mut r#rmv = None; + let mut r#ascent_rate = None; + let mut r#po2 = None; + let mut r#core_temperature = None; + let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#event = Some(field.into_value()); - } - 1u8 => { - r#event_type = Some(field.into_value()); - } - 2u8 => { - r#start_time = Some(field.into_value()); - } - 3u8 => { - r#total_elapsed_time = Some(field.into_value()); - } - 4u8 => { - r#total_timer_time = Some(field.into_value()); - } - 5u8 => { - r#total_strokes = Some(field.into_value()); - } - 6u8 => { - r#avg_speed = Some(field.into_value()); - } - 7u8 => { - r#swim_stroke = Some(field.into_value()); - } - 9u8 => { - r#avg_swimming_cadence = Some(field.into_value()); - } - 10u8 => { - r#event_group = Some(field.into_value()); - } - 11u8 => { - r#total_calories = Some(field.into_value()); - } - 12u8 => { - r#length_type = Some(field.into_value()); - } - 18u8 => { - r#player_score = Some(field.into_value()); - } - 19u8 => { - r#opponent_score = Some(field.into_value()); - } - 20u8 => { - r#stroke_count = Some(field.into_value()); - } - 21u8 => { - r#zone_count = Some(field.into_value()); - } - 22u8 => { - r#enhanced_avg_respiration_rate = Some(field.into_value()); - } - 23u8 => { - r#enhanced_max_respiration_rate = Some(field.into_value()); - } - 24u8 => { - r#avg_respiration_rate = Some(field.into_value()); - } - 25u8 => { - r#max_respiration_rate = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } - _ => { - if !options.ignore_unexpected_fields { - return Err(TryFromRecordError::unexpected_field(&field)); + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_lat", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_long", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("altitude", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("heart_rate", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("cadence", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("distance", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("speed", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#power = Some(_value); + } + Err(value) => { + invalid_fields.insert("power", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#compressed_speed_distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("compressed_speed_distance", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("grade", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#resistance = Some(_value); + } + Err(value) => { + invalid_fields.insert("resistance", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_from_course = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_from_course", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cycle_length = Some(_value); + } + Err(value) => { + invalid_fields.insert("cycle_length", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("temperature", value); + } + }, + 17u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#speed_1s = Some(_value); + } + Err(value) => { + invalid_fields.insert("speed_1s", value); + } + }, + 18u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cycles = Some(_value); + } + Err(value) => { + invalid_fields.insert("cycles", value); + } + }, + 19u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_cycles = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_cycles", value); + } + }, + 28u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#compressed_accumulated_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("compressed_accumulated_power", value); + } + }, + 29u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#accumulated_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("accumulated_power", value); + } + }, + 30u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#left_right_balance = Some(_value); + } + Err(value) => { + invalid_fields.insert("left_right_balance", value); + } + }, + 31u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gps_accuracy = Some(_value); + } + Err(value) => { + invalid_fields.insert("gps_accuracy", value); + } + }, + 32u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("vertical_speed", value); + } + }, + 33u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("calories", value); + } + }, + 39u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#vertical_oscillation = Some(_value); + } + Err(value) => { + invalid_fields.insert("vertical_oscillation", value); + } + }, + 40u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stance_time_percent = Some(_value); + } + Err(value) => { + invalid_fields.insert("stance_time_percent", value); + } + }, + 41u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stance_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("stance_time", value); + } + }, + 42u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#activity_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("activity_type", value); + } + }, + 43u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#left_torque_effectiveness = Some(_value); + } + Err(value) => { + invalid_fields.insert("left_torque_effectiveness", value); + } + }, + 44u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#right_torque_effectiveness = Some(_value); + } + Err(value) => { + invalid_fields.insert("right_torque_effectiveness", value); + } + }, + 45u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#left_pedal_smoothness = Some(_value); + } + Err(value) => { + invalid_fields.insert("left_pedal_smoothness", value); + } + }, + 46u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#right_pedal_smoothness = Some(_value); + } + Err(value) => { + invalid_fields.insert("right_pedal_smoothness", value); + } + }, + 47u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#combined_pedal_smoothness = Some(_value); + } + Err(value) => { + invalid_fields.insert("combined_pedal_smoothness", value); + } + }, + 48u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time128 = Some(_value); + } + Err(value) => { + invalid_fields.insert("time128", value); + } + }, + 49u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stroke_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("stroke_type", value); + } + }, + 50u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("zone", value); + } + }, + 51u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ball_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("ball_speed", value); + } + }, + 52u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cadence256 = Some(_value); + } + Err(value) => { + invalid_fields.insert("cadence256", value); + } + }, + 53u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#fractional_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("fractional_cadence", value); + } + }, + 54u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_hemoglobin_conc = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_hemoglobin_conc", value); + } + }, + 55u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_hemoglobin_conc_min = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_hemoglobin_conc_min", value); + } + }, + 56u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_hemoglobin_conc_max = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_hemoglobin_conc_max", value); + } + }, + 57u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#saturated_hemoglobin_percent = Some(_value); + } + Err(value) => { + invalid_fields.insert("saturated_hemoglobin_percent", value); + } + }, + 58u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#saturated_hemoglobin_percent_min = Some(_value); + } + Err(value) => { + invalid_fields.insert("saturated_hemoglobin_percent_min", value); + } + }, + 59u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#saturated_hemoglobin_percent_max = Some(_value); + } + Err(value) => { + invalid_fields.insert("saturated_hemoglobin_percent_max", value); + } + }, + 62u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#device_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("device_index", value); + } + }, + 67u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#left_pco = Some(_value); + } + Err(value) => { + invalid_fields.insert("left_pco", value); + } + }, + 68u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#right_pco = Some(_value); + } + Err(value) => { + invalid_fields.insert("right_pco", value); + } + }, + 69u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#left_power_phase = Some(_value); + } + Err(value) => { + invalid_fields.insert("left_power_phase", value); + } + }, + 70u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#left_power_phase_peak = Some(_value); + } + Err(value) => { + invalid_fields.insert("left_power_phase_peak", value); + } + }, + 71u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#right_power_phase = Some(_value); + } + Err(value) => { + invalid_fields.insert("right_power_phase", value); + } + }, + 72u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#right_power_phase_peak = Some(_value); + } + Err(value) => { + invalid_fields.insert("right_power_phase_peak", value); + } + }, + 73u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_speed", value); + } + }, + 78u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_altitude", value); + } + }, + 81u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#battery_soc = Some(_value); + } + Err(value) => { + invalid_fields.insert("battery_soc", value); + } + }, + 82u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#motor_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("motor_power", value); + } + }, + 83u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#vertical_ratio = Some(_value); + } + Err(value) => { + invalid_fields.insert("vertical_ratio", value); + } + }, + 84u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stance_time_balance = Some(_value); + } + Err(value) => { + invalid_fields.insert("stance_time_balance", value); + } + }, + 85u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#step_length = Some(_value); + } + Err(value) => { + invalid_fields.insert("step_length", value); + } + }, + 87u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cycle_length16 = Some(_value); + } + Err(value) => { + invalid_fields.insert("cycle_length16", value); + } + }, + 91u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#absolute_pressure = Some(_value); + } + Err(value) => { + invalid_fields.insert("absolute_pressure", value); + } + }, + 92u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("depth", value); + } + }, + 93u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#next_stop_depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("next_stop_depth", value); + } + }, + 94u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#next_stop_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("next_stop_time", value); + } + }, + 95u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_to_surface = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_to_surface", value); + } + }, + 96u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ndl_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("ndl_time", value); + } + }, + 97u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cns_load = Some(_value); + } + Err(value) => { + invalid_fields.insert("cns_load", value); + } + }, + 98u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#n2_load = Some(_value); + } + Err(value) => { + invalid_fields.insert("n2_load", value); + } + }, + 99u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("respiration_rate", value); + } + }, + 108u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_respiration_rate", value); + } + }, + 114u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#grit = Some(_value); + } + Err(value) => { + invalid_fields.insert("grit", value); + } + }, + 115u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#flow = Some(_value); + } + Err(value) => { + invalid_fields.insert("flow", value); + } + }, + 116u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#current_stress = Some(_value); + } + Err(value) => { + invalid_fields.insert("current_stress", value); + } + }, + 117u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ebike_travel_range = Some(_value); + } + Err(value) => { + invalid_fields.insert("ebike_travel_range", value); + } + }, + 118u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ebike_battery_level = Some(_value); + } + Err(value) => { + invalid_fields.insert("ebike_battery_level", value); + } + }, + 119u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ebike_assist_mode = Some(_value); + } + Err(value) => { + invalid_fields.insert("ebike_assist_mode", value); + } + }, + 120u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ebike_assist_level_percent = Some(_value); + } + Err(value) => { + invalid_fields.insert("ebike_assist_level_percent", value); + } + }, + 123u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#air_time_remaining = Some(_value); + } + Err(value) => { + invalid_fields.insert("air_time_remaining", value); + } + }, + 124u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pressure_sac = Some(_value); + } + Err(value) => { + invalid_fields.insert("pressure_sac", value); + } + }, + 125u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#volume_sac = Some(_value); + } + Err(value) => { + invalid_fields.insert("volume_sac", value); + } + }, + 126u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#rmv = Some(_value); + } + Err(value) => { + invalid_fields.insert("rmv", value); + } + }, + 127u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ascent_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("ascent_rate", value); + } + }, + 129u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#po2 = Some(_value); + } + Err(value) => { + invalid_fields.insert("po2", value); } - } - } - } - Ok(Self { - r#event, - r#event_type, - r#start_time, - r#total_elapsed_time, - r#total_timer_time, - r#total_strokes, - r#avg_speed, - r#swim_stroke, - r#avg_swimming_cadence, - r#event_group, - r#total_calories, - r#length_type, - r#player_score, - r#opponent_score, - r#stroke_count, - r#zone_count, - r#enhanced_avg_respiration_rate, - r#enhanced_max_respiration_rate, - r#avg_respiration_rate, - r#max_respiration_rate, - r#timestamp, - r#message_index, - }) - } -} -impl TryFrom for Length { - type Error = TryFromRecordError; - fn try_from(record: FitDataRecord) -> Result { - Self::parse(record) - } -} -#[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] -pub struct Record { - pub r#position_lat: Option, - pub r#position_long: Option, - pub r#altitude: Option, - pub r#heart_rate: Option, - pub r#cadence: Option, - pub r#distance: Option, - pub r#speed: Option, - pub r#power: Option, - pub r#compressed_speed_distance: Option, - pub r#grade: Option, - pub r#resistance: Option, - pub r#time_from_course: Option, - pub r#cycle_length: Option, - pub r#temperature: Option, - pub r#speed_1s: Option, - pub r#cycles: Option, - pub r#total_cycles: Option, - pub r#compressed_accumulated_power: Option, - pub r#accumulated_power: Option, - pub r#left_right_balance: Option, - pub r#gps_accuracy: Option, - pub r#vertical_speed: Option, - pub r#calories: Option, - pub r#vertical_oscillation: Option, - pub r#stance_time_percent: Option, - pub r#stance_time: Option, - pub r#activity_type: Option, - pub r#left_torque_effectiveness: Option, - pub r#right_torque_effectiveness: Option, - pub r#left_pedal_smoothness: Option, - pub r#right_pedal_smoothness: Option, - pub r#combined_pedal_smoothness: Option, - pub r#time128: Option, - pub r#stroke_type: Option, - pub r#zone: Option, - pub r#ball_speed: Option, - pub r#cadence256: Option, - pub r#fractional_cadence: Option, - pub r#total_hemoglobin_conc: Option, - pub r#total_hemoglobin_conc_min: Option, - pub r#total_hemoglobin_conc_max: Option, - pub r#saturated_hemoglobin_percent: Option, - pub r#saturated_hemoglobin_percent_min: Option, - pub r#saturated_hemoglobin_percent_max: Option, - pub r#device_index: Option, - pub r#left_pco: Option, - pub r#right_pco: Option, - pub r#left_power_phase: Option, - pub r#left_power_phase_peak: Option, - pub r#right_power_phase: Option, - pub r#right_power_phase_peak: Option, - pub r#enhanced_speed: Option, - pub r#enhanced_altitude: Option, - pub r#battery_soc: Option, - pub r#motor_power: Option, - pub r#vertical_ratio: Option, - pub r#stance_time_balance: Option, - pub r#step_length: Option, - pub r#cycle_length16: Option, - pub r#absolute_pressure: Option, - pub r#depth: Option, - pub r#next_stop_depth: Option, - pub r#next_stop_time: Option, - pub r#time_to_surface: Option, - pub r#ndl_time: Option, - pub r#cns_load: Option, - pub r#n2_load: Option, - pub r#respiration_rate: Option, - pub r#enhanced_respiration_rate: Option, - pub r#grit: Option, - pub r#flow: Option, - pub r#current_stress: Option, - pub r#ebike_travel_range: Option, - pub r#ebike_battery_level: Option, - pub r#ebike_assist_mode: Option, - pub r#ebike_assist_level_percent: Option, - pub r#air_time_remaining: Option, - pub r#pressure_sac: Option, - pub r#volume_sac: Option, - pub r#rmv: Option, - pub r#ascent_rate: Option, - pub r#po2: Option, - pub r#core_temperature: Option, - pub r#timestamp: Option, -} -impl FitMessage for Record { - const NAME: &'static str = "Record"; - const KIND: MesgNum = MesgNum::Record; - fn parse_with_options( - record: FitDataRecord, - options: MessageParseOptions, - ) -> Result { - if record.kind() != Self::KIND { - return Err(TryFromRecordError::unexpected_message_kind::(&record)); - } - let mut r#position_lat = None; - let mut r#position_long = None; - let mut r#altitude = None; - let mut r#heart_rate = None; - let mut r#cadence = None; - let mut r#distance = None; - let mut r#speed = None; - let mut r#power = None; - let mut r#compressed_speed_distance = None; - let mut r#grade = None; - let mut r#resistance = None; - let mut r#time_from_course = None; - let mut r#cycle_length = None; - let mut r#temperature = None; - let mut r#speed_1s = None; - let mut r#cycles = None; - let mut r#total_cycles = None; - let mut r#compressed_accumulated_power = None; - let mut r#accumulated_power = None; - let mut r#left_right_balance = None; - let mut r#gps_accuracy = None; - let mut r#vertical_speed = None; - let mut r#calories = None; - let mut r#vertical_oscillation = None; - let mut r#stance_time_percent = None; - let mut r#stance_time = None; - let mut r#activity_type = None; - let mut r#left_torque_effectiveness = None; - let mut r#right_torque_effectiveness = None; - let mut r#left_pedal_smoothness = None; - let mut r#right_pedal_smoothness = None; - let mut r#combined_pedal_smoothness = None; - let mut r#time128 = None; - let mut r#stroke_type = None; - let mut r#zone = None; - let mut r#ball_speed = None; - let mut r#cadence256 = None; - let mut r#fractional_cadence = None; - let mut r#total_hemoglobin_conc = None; - let mut r#total_hemoglobin_conc_min = None; - let mut r#total_hemoglobin_conc_max = None; - let mut r#saturated_hemoglobin_percent = None; - let mut r#saturated_hemoglobin_percent_min = None; - let mut r#saturated_hemoglobin_percent_max = None; - let mut r#device_index = None; - let mut r#left_pco = None; - let mut r#right_pco = None; - let mut r#left_power_phase = None; - let mut r#left_power_phase_peak = None; - let mut r#right_power_phase = None; - let mut r#right_power_phase_peak = None; - let mut r#enhanced_speed = None; - let mut r#enhanced_altitude = None; - let mut r#battery_soc = None; - let mut r#motor_power = None; - let mut r#vertical_ratio = None; - let mut r#stance_time_balance = None; - let mut r#step_length = None; - let mut r#cycle_length16 = None; - let mut r#absolute_pressure = None; - let mut r#depth = None; - let mut r#next_stop_depth = None; - let mut r#next_stop_time = None; - let mut r#time_to_surface = None; - let mut r#ndl_time = None; - let mut r#cns_load = None; - let mut r#n2_load = None; - let mut r#respiration_rate = None; - let mut r#enhanced_respiration_rate = None; - let mut r#grit = None; - let mut r#flow = None; - let mut r#current_stress = None; - let mut r#ebike_travel_range = None; - let mut r#ebike_battery_level = None; - let mut r#ebike_assist_mode = None; - let mut r#ebike_assist_level_percent = None; - let mut r#air_time_remaining = None; - let mut r#pressure_sac = None; - let mut r#volume_sac = None; - let mut r#rmv = None; - let mut r#ascent_rate = None; - let mut r#po2 = None; - let mut r#core_temperature = None; - let mut r#timestamp = None; - for field in record.into_vec() { - match field.number() { - 0u8 => { - r#position_lat = Some(field.into_value()); - } - 1u8 => { - r#position_long = Some(field.into_value()); - } - 2u8 => { - r#altitude = Some(field.into_value()); - } - 3u8 => { - r#heart_rate = Some(field.into_value()); - } - 4u8 => { - r#cadence = Some(field.into_value()); - } - 5u8 => { - r#distance = Some(field.into_value()); - } - 6u8 => { - r#speed = Some(field.into_value()); - } - 7u8 => { - r#power = Some(field.into_value()); - } - 8u8 => { - r#compressed_speed_distance = Some(field.into_value()); - } - 9u8 => { - r#grade = Some(field.into_value()); - } - 10u8 => { - r#resistance = Some(field.into_value()); - } - 11u8 => { - r#time_from_course = Some(field.into_value()); - } - 12u8 => { - r#cycle_length = Some(field.into_value()); - } - 13u8 => { - r#temperature = Some(field.into_value()); - } - 17u8 => { - r#speed_1s = Some(field.into_value()); - } - 18u8 => { - r#cycles = Some(field.into_value()); - } - 19u8 => { - r#total_cycles = Some(field.into_value()); - } - 28u8 => { - r#compressed_accumulated_power = Some(field.into_value()); - } - 29u8 => { - r#accumulated_power = Some(field.into_value()); - } - 30u8 => { - r#left_right_balance = Some(field.into_value()); - } - 31u8 => { - r#gps_accuracy = Some(field.into_value()); - } - 32u8 => { - r#vertical_speed = Some(field.into_value()); - } - 33u8 => { - r#calories = Some(field.into_value()); - } - 39u8 => { - r#vertical_oscillation = Some(field.into_value()); - } - 40u8 => { - r#stance_time_percent = Some(field.into_value()); - } - 41u8 => { - r#stance_time = Some(field.into_value()); - } - 42u8 => { - r#activity_type = Some(field.into_value()); - } - 43u8 => { - r#left_torque_effectiveness = Some(field.into_value()); - } - 44u8 => { - r#right_torque_effectiveness = Some(field.into_value()); - } - 45u8 => { - r#left_pedal_smoothness = Some(field.into_value()); - } - 46u8 => { - r#right_pedal_smoothness = Some(field.into_value()); - } - 47u8 => { - r#combined_pedal_smoothness = Some(field.into_value()); - } - 48u8 => { - r#time128 = Some(field.into_value()); - } - 49u8 => { - r#stroke_type = Some(field.into_value()); - } - 50u8 => { - r#zone = Some(field.into_value()); - } - 51u8 => { - r#ball_speed = Some(field.into_value()); - } - 52u8 => { - r#cadence256 = Some(field.into_value()); - } - 53u8 => { - r#fractional_cadence = Some(field.into_value()); - } - 54u8 => { - r#total_hemoglobin_conc = Some(field.into_value()); - } - 55u8 => { - r#total_hemoglobin_conc_min = Some(field.into_value()); - } - 56u8 => { - r#total_hemoglobin_conc_max = Some(field.into_value()); - } - 57u8 => { - r#saturated_hemoglobin_percent = Some(field.into_value()); - } - 58u8 => { - r#saturated_hemoglobin_percent_min = Some(field.into_value()); - } - 59u8 => { - r#saturated_hemoglobin_percent_max = Some(field.into_value()); - } - 62u8 => { - r#device_index = Some(field.into_value()); - } - 67u8 => { - r#left_pco = Some(field.into_value()); - } - 68u8 => { - r#right_pco = Some(field.into_value()); - } - 69u8 => { - r#left_power_phase = Some(field.into_value()); - } - 70u8 => { - r#left_power_phase_peak = Some(field.into_value()); - } - 71u8 => { - r#right_power_phase = Some(field.into_value()); - } - 72u8 => { - r#right_power_phase_peak = Some(field.into_value()); - } - 73u8 => { - r#enhanced_speed = Some(field.into_value()); - } - 78u8 => { - r#enhanced_altitude = Some(field.into_value()); - } - 81u8 => { - r#battery_soc = Some(field.into_value()); - } - 82u8 => { - r#motor_power = Some(field.into_value()); - } - 83u8 => { - r#vertical_ratio = Some(field.into_value()); - } - 84u8 => { - r#stance_time_balance = Some(field.into_value()); - } - 85u8 => { - r#step_length = Some(field.into_value()); - } - 87u8 => { - r#cycle_length16 = Some(field.into_value()); - } - 91u8 => { - r#absolute_pressure = Some(field.into_value()); - } - 92u8 => { - r#depth = Some(field.into_value()); - } - 93u8 => { - r#next_stop_depth = Some(field.into_value()); - } - 94u8 => { - r#next_stop_time = Some(field.into_value()); - } - 95u8 => { - r#time_to_surface = Some(field.into_value()); - } - 96u8 => { - r#ndl_time = Some(field.into_value()); - } - 97u8 => { - r#cns_load = Some(field.into_value()); - } - 98u8 => { - r#n2_load = Some(field.into_value()); - } - 99u8 => { - r#respiration_rate = Some(field.into_value()); - } - 108u8 => { - r#enhanced_respiration_rate = Some(field.into_value()); - } - 114u8 => { - r#grit = Some(field.into_value()); - } - 115u8 => { - r#flow = Some(field.into_value()); - } - 116u8 => { - r#current_stress = Some(field.into_value()); - } - 117u8 => { - r#ebike_travel_range = Some(field.into_value()); - } - 118u8 => { - r#ebike_battery_level = Some(field.into_value()); - } - 119u8 => { - r#ebike_assist_mode = Some(field.into_value()); - } - 120u8 => { - r#ebike_assist_level_percent = Some(field.into_value()); - } - 123u8 => { - r#air_time_remaining = Some(field.into_value()); - } - 124u8 => { - r#pressure_sac = Some(field.into_value()); - } - 125u8 => { - r#volume_sac = Some(field.into_value()); - } - 126u8 => { - r#rmv = Some(field.into_value()); - } - 127u8 => { - r#ascent_rate = Some(field.into_value()); - } - 129u8 => { - r#po2 = Some(field.into_value()); - } - 139u8 => { - r#core_temperature = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + }, + 139u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#core_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("core_temperature", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -5543,8 +9250,12 @@ impl FitMessage for Record { r#po2, r#core_temperature, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Record { type Error = TryFromRecordError; @@ -5554,25 +9265,26 @@ impl TryFrom for Record { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Event { - pub r#event: Option, - pub r#event_type: Option, - pub r#data16: Option, - pub r#data: Option, - pub r#event_group: Option, - pub r#score: Option, - pub r#opponent_score: Option, - pub r#front_gear_num: Option, - pub r#front_gear: Option, - pub r#rear_gear_num: Option, - pub r#rear_gear: Option, - pub r#device_index: Option, - pub r#activity_type: Option, - pub r#start_timestamp: Option, - pub r#radar_threat_level_max: Option, - pub r#radar_threat_count: Option, - pub r#radar_threat_avg_approach_speed: Option, - pub r#radar_threat_max_approach_speed: Option, - pub r#timestamp: Option, + pub r#event: Option, + pub r#event_type: Option, + pub r#data16: Option, + pub r#data: Option, + pub r#event_group: Option, + pub r#score: Option, + pub r#opponent_score: Option, + pub r#front_gear_num: Option, + pub r#front_gear: Option, + pub r#rear_gear_num: Option, + pub r#rear_gear: Option, + pub r#device_index: Option, + pub r#activity_type: Option, + pub r#start_timestamp: Option, + pub r#radar_threat_level_max: Option, + pub r#radar_threat_count: Option, + pub r#radar_threat_avg_approach_speed: Option, + pub r#radar_threat_max_approach_speed: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Event { const NAME: &'static str = "Event"; @@ -5603,65 +9315,162 @@ impl FitMessage for Event { let mut r#radar_threat_avg_approach_speed = None; let mut r#radar_threat_max_approach_speed = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#event = Some(field.into_value()); - } - 1u8 => { - r#event_type = Some(field.into_value()); - } - 2u8 => { - r#data16 = Some(field.into_value()); - } - 3u8 => { - r#data = Some(field.into_value()); - } - 4u8 => { - r#event_group = Some(field.into_value()); - } - 7u8 => { - r#score = Some(field.into_value()); - } - 8u8 => { - r#opponent_score = Some(field.into_value()); - } - 9u8 => { - r#front_gear_num = Some(field.into_value()); - } - 10u8 => { - r#front_gear = Some(field.into_value()); - } - 11u8 => { - r#rear_gear_num = Some(field.into_value()); - } - 12u8 => { - r#rear_gear = Some(field.into_value()); - } - 13u8 => { - r#device_index = Some(field.into_value()); - } - 14u8 => { - r#activity_type = Some(field.into_value()); - } - 15u8 => { - r#start_timestamp = Some(field.into_value()); - } - 21u8 => { - r#radar_threat_level_max = Some(field.into_value()); - } - 22u8 => { - r#radar_threat_count = Some(field.into_value()); - } - 23u8 => { - r#radar_threat_avg_approach_speed = Some(field.into_value()); - } - 24u8 => { - r#radar_threat_max_approach_speed = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event = Some(_value); + } + Err(value) => { + invalid_fields.insert("event", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_type", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#data16 = Some(_value); + } + Err(value) => { + invalid_fields.insert("data16", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#data = Some(_value); + } + Err(value) => { + invalid_fields.insert("data", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_group = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_group", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#score = Some(_value); + } + Err(value) => { + invalid_fields.insert("score", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#opponent_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("opponent_score", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#front_gear_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("front_gear_num", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#front_gear = Some(_value); + } + Err(value) => { + invalid_fields.insert("front_gear", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#rear_gear_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("rear_gear_num", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#rear_gear = Some(_value); + } + Err(value) => { + invalid_fields.insert("rear_gear", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#device_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("device_index", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#activity_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("activity_type", value); + } + }, + 15u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_timestamp", value); + } + }, + 21u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#radar_threat_level_max = Some(_value); + } + Err(value) => { + invalid_fields.insert("radar_threat_level_max", value); + } + }, + 22u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#radar_threat_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("radar_threat_count", value); + } + }, + 23u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#radar_threat_avg_approach_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("radar_threat_avg_approach_speed", value); + } + }, + 24u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#radar_threat_max_approach_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("radar_threat_max_approach_speed", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -5689,8 +9498,12 @@ impl FitMessage for Event { r#radar_threat_avg_approach_speed, r#radar_threat_max_approach_speed, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Event { type Error = TryFromRecordError; @@ -5700,25 +9513,26 @@ impl TryFrom for Event { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct DeviceInfo { - pub r#device_index: Option, - pub r#device_type: Option, - pub r#manufacturer: Option, - pub r#serial_number: Option, - pub r#product: Option, - pub r#software_version: Option, - pub r#hardware_version: Option, - pub r#cum_operating_time: Option, - pub r#battery_voltage: Option, - pub r#battery_status: Option, - pub r#sensor_position: Option, - pub r#descriptor: Option, - pub r#ant_transmission_type: Option, - pub r#ant_device_number: Option, - pub r#ant_network: Option, - pub r#source_type: Option, - pub r#product_name: Option, - pub r#battery_level: Option, - pub r#timestamp: Option, + pub r#device_index: Option, + pub r#device_type: Option, + pub r#manufacturer: Option, + pub r#serial_number: Option, + pub r#product: Option, + pub r#software_version: Option, + pub r#hardware_version: Option, + pub r#cum_operating_time: Option, + pub r#battery_voltage: Option, + pub r#battery_status: Option, + pub r#sensor_position: Option, + pub r#descriptor: Option, + pub r#ant_transmission_type: Option, + pub r#ant_device_number: Option, + pub r#ant_network: Option, + pub r#source_type: Option, + pub r#product_name: Option, + pub r#battery_level: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for DeviceInfo { const NAME: &'static str = "DeviceInfo"; @@ -5749,65 +9563,162 @@ impl FitMessage for DeviceInfo { let mut r#product_name = None; let mut r#battery_level = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#device_index = Some(field.into_value()); - } - 1u8 => { - r#device_type = Some(field.into_value()); - } - 2u8 => { - r#manufacturer = Some(field.into_value()); - } - 3u8 => { - r#serial_number = Some(field.into_value()); - } - 4u8 => { - r#product = Some(field.into_value()); - } - 5u8 => { - r#software_version = Some(field.into_value()); - } - 6u8 => { - r#hardware_version = Some(field.into_value()); - } - 7u8 => { - r#cum_operating_time = Some(field.into_value()); - } - 10u8 => { - r#battery_voltage = Some(field.into_value()); - } - 11u8 => { - r#battery_status = Some(field.into_value()); - } - 18u8 => { - r#sensor_position = Some(field.into_value()); - } - 19u8 => { - r#descriptor = Some(field.into_value()); - } - 20u8 => { - r#ant_transmission_type = Some(field.into_value()); - } - 21u8 => { - r#ant_device_number = Some(field.into_value()); - } - 22u8 => { - r#ant_network = Some(field.into_value()); - } - 25u8 => { - r#source_type = Some(field.into_value()); - } - 27u8 => { - r#product_name = Some(field.into_value()); - } - 32u8 => { - r#battery_level = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#device_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("device_index", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#device_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("device_type", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#manufacturer = Some(_value); + } + Err(value) => { + invalid_fields.insert("manufacturer", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#serial_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("serial_number", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#product = Some(_value); + } + Err(value) => { + invalid_fields.insert("product", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#software_version = Some(_value); + } + Err(value) => { + invalid_fields.insert("software_version", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#hardware_version = Some(_value); + } + Err(value) => { + invalid_fields.insert("hardware_version", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cum_operating_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("cum_operating_time", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#battery_voltage = Some(_value); + } + Err(value) => { + invalid_fields.insert("battery_voltage", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#battery_status = Some(_value); + } + Err(value) => { + invalid_fields.insert("battery_status", value); + } + }, + 18u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sensor_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("sensor_position", value); + } + }, + 19u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#descriptor = Some(_value); + } + Err(value) => { + invalid_fields.insert("descriptor", value); + } + }, + 20u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ant_transmission_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("ant_transmission_type", value); + } + }, + 21u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ant_device_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("ant_device_number", value); + } + }, + 22u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ant_network = Some(_value); + } + Err(value) => { + invalid_fields.insert("ant_network", value); + } + }, + 25u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#source_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("source_type", value); + } + }, + 27u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#product_name = Some(_value); + } + Err(value) => { + invalid_fields.insert("product_name", value); + } + }, + 32u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#battery_level = Some(_value); + } + Err(value) => { + invalid_fields.insert("battery_level", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -5835,8 +9746,12 @@ impl FitMessage for DeviceInfo { r#product_name, r#battery_level, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for DeviceInfo { type Error = TryFromRecordError; @@ -5846,11 +9761,12 @@ impl TryFrom for DeviceInfo { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct DeviceAuxBatteryInfo { - pub r#device_index: Option, - pub r#battery_voltage: Option, - pub r#battery_status: Option, - pub r#battery_identifier: Option, - pub r#timestamp: Option, + pub r#device_index: Option, + pub r#battery_voltage: Option, + pub r#battery_status: Option, + pub r#battery_identifier: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for DeviceAuxBatteryInfo { const NAME: &'static str = "DeviceAuxBatteryInfo"; @@ -5867,23 +9783,50 @@ impl FitMessage for DeviceAuxBatteryInfo { let mut r#battery_status = None; let mut r#battery_identifier = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#device_index = Some(field.into_value()); - } - 1u8 => { - r#battery_voltage = Some(field.into_value()); - } - 2u8 => { - r#battery_status = Some(field.into_value()); - } - 3u8 => { - r#battery_identifier = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#device_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("device_index", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#battery_voltage = Some(_value); + } + Err(value) => { + invalid_fields.insert("battery_voltage", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#battery_status = Some(_value); + } + Err(value) => { + invalid_fields.insert("battery_status", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#battery_identifier = Some(_value); + } + Err(value) => { + invalid_fields.insert("battery_identifier", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -5897,8 +9840,12 @@ impl FitMessage for DeviceAuxBatteryInfo { r#battery_status, r#battery_identifier, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for DeviceAuxBatteryInfo { type Error = TryFromRecordError; @@ -5909,12 +9856,13 @@ impl TryFrom for DeviceAuxBatteryInfo { #[doc = "Corresponds to file_id of workout or course."] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct TrainingFile { - pub r#type: Option, - pub r#manufacturer: Option, - pub r#product: Option, - pub r#serial_number: Option, - pub r#time_created: Option, - pub r#timestamp: Option, + pub r#type: Option, + pub r#manufacturer: Option, + pub r#product: Option, + pub r#serial_number: Option, + pub r#time_created: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for TrainingFile { const NAME: &'static str = "TrainingFile"; @@ -5932,26 +9880,58 @@ impl FitMessage for TrainingFile { let mut r#serial_number = None; let mut r#time_created = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#type = Some(field.into_value()); - } - 1u8 => { - r#manufacturer = Some(field.into_value()); - } - 2u8 => { - r#product = Some(field.into_value()); - } - 3u8 => { - r#serial_number = Some(field.into_value()); - } - 4u8 => { - r#time_created = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#type = Some(_value); + } + Err(value) => { + invalid_fields.insert("type", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#manufacturer = Some(_value); + } + Err(value) => { + invalid_fields.insert("manufacturer", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#product = Some(_value); + } + Err(value) => { + invalid_fields.insert("product", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#serial_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("serial_number", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_created = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_created", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -5966,8 +9946,12 @@ impl FitMessage for TrainingFile { r#serial_number, r#time_created, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for TrainingFile { type Error = TryFromRecordError; @@ -5977,22 +9961,23 @@ impl TryFrom for TrainingFile { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct WeatherConditions { - pub r#weather_report: Option, - pub r#temperature: Option, - pub r#condition: Option, - pub r#wind_direction: Option, - pub r#wind_speed: Option, - pub r#precipitation_probability: Option, - pub r#temperature_feels_like: Option, - pub r#relative_humidity: Option, - pub r#location: Option, - pub r#observed_at_time: Option, - pub r#observed_location_lat: Option, - pub r#observed_location_long: Option, - pub r#day_of_week: Option, - pub r#high_temperature: Option, - pub r#low_temperature: Option, - pub r#timestamp: Option, + pub r#weather_report: Option, + pub r#temperature: Option, + pub r#condition: Option, + pub r#wind_direction: Option, + pub r#wind_speed: Option, + pub r#precipitation_probability: Option, + pub r#temperature_feels_like: Option, + pub r#relative_humidity: Option, + pub r#location: Option, + pub r#observed_at_time: Option, + pub r#observed_location_lat: Option, + pub r#observed_location_long: Option, + pub r#day_of_week: Option, + pub r#high_temperature: Option, + pub r#low_temperature: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for WeatherConditions { const NAME: &'static str = "WeatherConditions"; @@ -6020,56 +10005,138 @@ impl FitMessage for WeatherConditions { let mut r#high_temperature = None; let mut r#low_temperature = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#weather_report = Some(field.into_value()); - } - 1u8 => { - r#temperature = Some(field.into_value()); - } - 2u8 => { - r#condition = Some(field.into_value()); - } - 3u8 => { - r#wind_direction = Some(field.into_value()); - } - 4u8 => { - r#wind_speed = Some(field.into_value()); - } - 5u8 => { - r#precipitation_probability = Some(field.into_value()); - } - 6u8 => { - r#temperature_feels_like = Some(field.into_value()); - } - 7u8 => { - r#relative_humidity = Some(field.into_value()); - } - 8u8 => { - r#location = Some(field.into_value()); - } - 9u8 => { - r#observed_at_time = Some(field.into_value()); - } - 10u8 => { - r#observed_location_lat = Some(field.into_value()); - } - 11u8 => { - r#observed_location_long = Some(field.into_value()); - } - 12u8 => { - r#day_of_week = Some(field.into_value()); - } - 13u8 => { - r#high_temperature = Some(field.into_value()); - } - 14u8 => { - r#low_temperature = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#weather_report = Some(_value); + } + Err(value) => { + invalid_fields.insert("weather_report", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("temperature", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#condition = Some(_value); + } + Err(value) => { + invalid_fields.insert("condition", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#wind_direction = Some(_value); + } + Err(value) => { + invalid_fields.insert("wind_direction", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#wind_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("wind_speed", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#precipitation_probability = Some(_value); + } + Err(value) => { + invalid_fields.insert("precipitation_probability", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#temperature_feels_like = Some(_value); + } + Err(value) => { + invalid_fields.insert("temperature_feels_like", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#relative_humidity = Some(_value); + } + Err(value) => { + invalid_fields.insert("relative_humidity", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#location = Some(_value); + } + Err(value) => { + invalid_fields.insert("location", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#observed_at_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("observed_at_time", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#observed_location_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("observed_location_lat", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#observed_location_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("observed_location_long", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#day_of_week = Some(_value); + } + Err(value) => { + invalid_fields.insert("day_of_week", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#high_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("high_temperature", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#low_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("low_temperature", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6094,8 +10161,12 @@ impl FitMessage for WeatherConditions { r#high_temperature, r#low_temperature, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for WeatherConditions { type Error = TryFromRecordError; @@ -6105,12 +10176,13 @@ impl TryFrom for WeatherConditions { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct WeatherAlert { - pub r#report_id: Option, - pub r#issue_time: Option, - pub r#expire_time: Option, - pub r#severity: Option, - pub r#type: Option, - pub r#timestamp: Option, + pub r#report_id: Option, + pub r#issue_time: Option, + pub r#expire_time: Option, + pub r#severity: Option, + pub r#type: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for WeatherAlert { const NAME: &'static str = "WeatherAlert"; @@ -6128,26 +10200,58 @@ impl FitMessage for WeatherAlert { let mut r#severity = None; let mut r#type = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#report_id = Some(field.into_value()); - } - 1u8 => { - r#issue_time = Some(field.into_value()); - } - 2u8 => { - r#expire_time = Some(field.into_value()); - } - 3u8 => { - r#severity = Some(field.into_value()); - } - 4u8 => { - r#type = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#report_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("report_id", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#issue_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("issue_time", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#expire_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("expire_time", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#severity = Some(_value); + } + Err(value) => { + invalid_fields.insert("severity", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#type = Some(_value); + } + Err(value) => { + invalid_fields.insert("type", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6162,8 +10266,12 @@ impl FitMessage for WeatherAlert { r#severity, r#type, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for WeatherAlert { type Error = TryFromRecordError; @@ -6173,15 +10281,16 @@ impl TryFrom for WeatherAlert { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct GpsMetadata { - pub r#timestamp_ms: Option, - pub r#position_lat: Option, - pub r#position_long: Option, - pub r#enhanced_altitude: Option, - pub r#enhanced_speed: Option, - pub r#heading: Option, - pub r#utc_timestamp: Option, - pub r#velocity: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#position_lat: Option, + pub r#position_long: Option, + pub r#enhanced_altitude: Option, + pub r#enhanced_speed: Option, + pub r#heading: Option, + pub r#utc_timestamp: Option, + pub r#velocity: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for GpsMetadata { const NAME: &'static str = "GpsMetadata"; @@ -6202,35 +10311,82 @@ impl FitMessage for GpsMetadata { let mut r#utc_timestamp = None; let mut r#velocity = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#position_lat = Some(field.into_value()); - } - 2u8 => { - r#position_long = Some(field.into_value()); - } - 3u8 => { - r#enhanced_altitude = Some(field.into_value()); - } - 4u8 => { - r#enhanced_speed = Some(field.into_value()); - } - 5u8 => { - r#heading = Some(field.into_value()); - } - 6u8 => { - r#utc_timestamp = Some(field.into_value()); - } - 7u8 => { - r#velocity = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_lat", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_long", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_altitude", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_speed", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#heading = Some(_value); + } + Err(value) => { + invalid_fields.insert("heading", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#utc_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("utc_timestamp", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#velocity = Some(_value); + } + Err(value) => { + invalid_fields.insert("velocity", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6248,8 +10404,12 @@ impl FitMessage for GpsMetadata { r#utc_timestamp, r#velocity, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for GpsMetadata { type Error = TryFromRecordError; @@ -6259,11 +10419,12 @@ impl TryFrom for GpsMetadata { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct CameraEvent { - pub r#timestamp_ms: Option, - pub r#camera_event_type: Option, - pub r#camera_file_uuid: Option, - pub r#camera_orientation: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#camera_event_type: Option, + pub r#camera_file_uuid: Option, + pub r#camera_orientation: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for CameraEvent { const NAME: &'static str = "CameraEvent"; @@ -6280,23 +10441,50 @@ impl FitMessage for CameraEvent { let mut r#camera_file_uuid = None; let mut r#camera_orientation = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#camera_event_type = Some(field.into_value()); - } - 2u8 => { - r#camera_file_uuid = Some(field.into_value()); - } - 3u8 => { - r#camera_orientation = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#camera_event_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("camera_event_type", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#camera_file_uuid = Some(_value); + } + Err(value) => { + invalid_fields.insert("camera_file_uuid", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#camera_orientation = Some(_value); + } + Err(value) => { + invalid_fields.insert("camera_orientation", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6310,8 +10498,12 @@ impl FitMessage for CameraEvent { r#camera_file_uuid, r#camera_orientation, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for CameraEvent { type Error = TryFromRecordError; @@ -6321,15 +10513,16 @@ impl TryFrom for CameraEvent { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct GyroscopeData { - pub r#timestamp_ms: Option, - pub r#sample_time_offset: Option, - pub r#gyro_x: Option, - pub r#gyro_y: Option, - pub r#gyro_z: Option, - pub r#calibrated_gyro_x: Option, - pub r#calibrated_gyro_y: Option, - pub r#calibrated_gyro_z: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#sample_time_offset: Option, + pub r#gyro_x: Option, + pub r#gyro_y: Option, + pub r#gyro_z: Option, + pub r#calibrated_gyro_x: Option, + pub r#calibrated_gyro_y: Option, + pub r#calibrated_gyro_z: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for GyroscopeData { const NAME: &'static str = "GyroscopeData"; @@ -6350,35 +10543,82 @@ impl FitMessage for GyroscopeData { let mut r#calibrated_gyro_y = None; let mut r#calibrated_gyro_z = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#sample_time_offset = Some(field.into_value()); - } - 2u8 => { - r#gyro_x = Some(field.into_value()); - } - 3u8 => { - r#gyro_y = Some(field.into_value()); - } - 4u8 => { - r#gyro_z = Some(field.into_value()); - } - 5u8 => { - r#calibrated_gyro_x = Some(field.into_value()); - } - 6u8 => { - r#calibrated_gyro_y = Some(field.into_value()); - } - 7u8 => { - r#calibrated_gyro_z = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sample_time_offset = Some(_value); + } + Err(value) => { + invalid_fields.insert("sample_time_offset", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gyro_x = Some(_value); + } + Err(value) => { + invalid_fields.insert("gyro_x", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gyro_y = Some(_value); + } + Err(value) => { + invalid_fields.insert("gyro_y", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gyro_z = Some(_value); + } + Err(value) => { + invalid_fields.insert("gyro_z", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibrated_gyro_x = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibrated_gyro_x", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibrated_gyro_y = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibrated_gyro_y", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibrated_gyro_z = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibrated_gyro_z", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6396,8 +10636,12 @@ impl FitMessage for GyroscopeData { r#calibrated_gyro_y, r#calibrated_gyro_z, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for GyroscopeData { type Error = TryFromRecordError; @@ -6407,18 +10651,19 @@ impl TryFrom for GyroscopeData { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct AccelerometerData { - pub r#timestamp_ms: Option, - pub r#sample_time_offset: Option, - pub r#accel_x: Option, - pub r#accel_y: Option, - pub r#accel_z: Option, - pub r#calibrated_accel_x: Option, - pub r#calibrated_accel_y: Option, - pub r#calibrated_accel_z: Option, - pub r#compressed_calibrated_accel_x: Option, - pub r#compressed_calibrated_accel_y: Option, - pub r#compressed_calibrated_accel_z: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#sample_time_offset: Option, + pub r#accel_x: Option, + pub r#accel_y: Option, + pub r#accel_z: Option, + pub r#calibrated_accel_x: Option, + pub r#calibrated_accel_y: Option, + pub r#calibrated_accel_z: Option, + pub r#compressed_calibrated_accel_x: Option, + pub r#compressed_calibrated_accel_y: Option, + pub r#compressed_calibrated_accel_z: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for AccelerometerData { const NAME: &'static str = "AccelerometerData"; @@ -6442,44 +10687,106 @@ impl FitMessage for AccelerometerData { let mut r#compressed_calibrated_accel_y = None; let mut r#compressed_calibrated_accel_z = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#sample_time_offset = Some(field.into_value()); - } - 2u8 => { - r#accel_x = Some(field.into_value()); - } - 3u8 => { - r#accel_y = Some(field.into_value()); - } - 4u8 => { - r#accel_z = Some(field.into_value()); - } - 5u8 => { - r#calibrated_accel_x = Some(field.into_value()); - } - 6u8 => { - r#calibrated_accel_y = Some(field.into_value()); - } - 7u8 => { - r#calibrated_accel_z = Some(field.into_value()); - } - 8u8 => { - r#compressed_calibrated_accel_x = Some(field.into_value()); - } - 9u8 => { - r#compressed_calibrated_accel_y = Some(field.into_value()); - } - 10u8 => { - r#compressed_calibrated_accel_z = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sample_time_offset = Some(_value); + } + Err(value) => { + invalid_fields.insert("sample_time_offset", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#accel_x = Some(_value); + } + Err(value) => { + invalid_fields.insert("accel_x", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#accel_y = Some(_value); + } + Err(value) => { + invalid_fields.insert("accel_y", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#accel_z = Some(_value); + } + Err(value) => { + invalid_fields.insert("accel_z", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibrated_accel_x = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibrated_accel_x", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibrated_accel_y = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibrated_accel_y", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibrated_accel_z = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibrated_accel_z", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#compressed_calibrated_accel_x = Some(_value); + } + Err(value) => { + invalid_fields.insert("compressed_calibrated_accel_x", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#compressed_calibrated_accel_y = Some(_value); + } + Err(value) => { + invalid_fields.insert("compressed_calibrated_accel_y", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#compressed_calibrated_accel_z = Some(_value); + } + Err(value) => { + invalid_fields.insert("compressed_calibrated_accel_z", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6500,8 +10807,12 @@ impl FitMessage for AccelerometerData { r#compressed_calibrated_accel_y, r#compressed_calibrated_accel_z, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for AccelerometerData { type Error = TryFromRecordError; @@ -6511,15 +10822,16 @@ impl TryFrom for AccelerometerData { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct MagnetometerData { - pub r#timestamp_ms: Option, - pub r#sample_time_offset: Option, - pub r#mag_x: Option, - pub r#mag_y: Option, - pub r#mag_z: Option, - pub r#calibrated_mag_x: Option, - pub r#calibrated_mag_y: Option, - pub r#calibrated_mag_z: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#sample_time_offset: Option, + pub r#mag_x: Option, + pub r#mag_y: Option, + pub r#mag_z: Option, + pub r#calibrated_mag_x: Option, + pub r#calibrated_mag_y: Option, + pub r#calibrated_mag_z: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for MagnetometerData { const NAME: &'static str = "MagnetometerData"; @@ -6540,35 +10852,82 @@ impl FitMessage for MagnetometerData { let mut r#calibrated_mag_y = None; let mut r#calibrated_mag_z = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#sample_time_offset = Some(field.into_value()); - } - 2u8 => { - r#mag_x = Some(field.into_value()); - } - 3u8 => { - r#mag_y = Some(field.into_value()); - } - 4u8 => { - r#mag_z = Some(field.into_value()); - } - 5u8 => { - r#calibrated_mag_x = Some(field.into_value()); - } - 6u8 => { - r#calibrated_mag_y = Some(field.into_value()); - } - 7u8 => { - r#calibrated_mag_z = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sample_time_offset = Some(_value); + } + Err(value) => { + invalid_fields.insert("sample_time_offset", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mag_x = Some(_value); + } + Err(value) => { + invalid_fields.insert("mag_x", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mag_y = Some(_value); + } + Err(value) => { + invalid_fields.insert("mag_y", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mag_z = Some(_value); + } + Err(value) => { + invalid_fields.insert("mag_z", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibrated_mag_x = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibrated_mag_x", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibrated_mag_y = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibrated_mag_y", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibrated_mag_z = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibrated_mag_z", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6586,8 +10945,12 @@ impl FitMessage for MagnetometerData { r#calibrated_mag_y, r#calibrated_mag_z, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for MagnetometerData { type Error = TryFromRecordError; @@ -6597,10 +10960,11 @@ impl TryFrom for MagnetometerData { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct BarometerData { - pub r#timestamp_ms: Option, - pub r#sample_time_offset: Option, - pub r#baro_pres: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#sample_time_offset: Option, + pub r#baro_pres: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for BarometerData { const NAME: &'static str = "BarometerData"; @@ -6616,20 +10980,42 @@ impl FitMessage for BarometerData { let mut r#sample_time_offset = None; let mut r#baro_pres = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#sample_time_offset = Some(field.into_value()); - } - 2u8 => { - r#baro_pres = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sample_time_offset = Some(_value); + } + Err(value) => { + invalid_fields.insert("sample_time_offset", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#baro_pres = Some(_value); + } + Err(value) => { + invalid_fields.insert("baro_pres", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6642,8 +11028,12 @@ impl FitMessage for BarometerData { r#sample_time_offset, r#baro_pres, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for BarometerData { type Error = TryFromRecordError; @@ -6653,13 +11043,14 @@ impl TryFrom for BarometerData { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct ThreeDSensorCalibration { - pub r#sensor_type: Option, - pub r#calibration_factor: Option, - pub r#calibration_divisor: Option, - pub r#level_shift: Option, - pub r#offset_cal: Option, - pub r#orientation_matrix: Option, - pub r#timestamp: Option, + pub r#sensor_type: Option, + pub r#calibration_factor: Option, + pub r#calibration_divisor: Option, + pub r#level_shift: Option, + pub r#offset_cal: Option, + pub r#orientation_matrix: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for ThreeDSensorCalibration { const NAME: &'static str = "ThreeDSensorCalibration"; @@ -6678,29 +11069,66 @@ impl FitMessage for ThreeDSensorCalibration { let mut r#offset_cal = None; let mut r#orientation_matrix = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#sensor_type = Some(field.into_value()); - } - 1u8 => { - r#calibration_factor = Some(field.into_value()); - } - 2u8 => { - r#calibration_divisor = Some(field.into_value()); - } - 3u8 => { - r#level_shift = Some(field.into_value()); - } - 4u8 => { - r#offset_cal = Some(field.into_value()); - } - 5u8 => { - r#orientation_matrix = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sensor_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("sensor_type", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibration_factor = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibration_factor", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibration_divisor = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibration_divisor", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#level_shift = Some(_value); + } + Err(value) => { + invalid_fields.insert("level_shift", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#offset_cal = Some(_value); + } + Err(value) => { + invalid_fields.insert("offset_cal", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#orientation_matrix = Some(_value); + } + Err(value) => { + invalid_fields.insert("orientation_matrix", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6716,8 +11144,12 @@ impl FitMessage for ThreeDSensorCalibration { r#offset_cal, r#orientation_matrix, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for ThreeDSensorCalibration { type Error = TryFromRecordError; @@ -6727,12 +11159,13 @@ impl TryFrom for ThreeDSensorCalibration { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct OneDSensorCalibration { - pub r#sensor_type: Option, - pub r#calibration_factor: Option, - pub r#calibration_divisor: Option, - pub r#level_shift: Option, - pub r#offset_cal: Option, - pub r#timestamp: Option, + pub r#sensor_type: Option, + pub r#calibration_factor: Option, + pub r#calibration_divisor: Option, + pub r#level_shift: Option, + pub r#offset_cal: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for OneDSensorCalibration { const NAME: &'static str = "OneDSensorCalibration"; @@ -6750,26 +11183,58 @@ impl FitMessage for OneDSensorCalibration { let mut r#level_shift = None; let mut r#offset_cal = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#sensor_type = Some(field.into_value()); - } - 1u8 => { - r#calibration_factor = Some(field.into_value()); - } - 2u8 => { - r#calibration_divisor = Some(field.into_value()); - } - 3u8 => { - r#level_shift = Some(field.into_value()); - } - 4u8 => { - r#offset_cal = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sensor_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("sensor_type", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibration_factor = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibration_factor", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibration_divisor = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibration_divisor", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#level_shift = Some(_value); + } + Err(value) => { + invalid_fields.insert("level_shift", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#offset_cal = Some(_value); + } + Err(value) => { + invalid_fields.insert("offset_cal", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6784,8 +11249,12 @@ impl FitMessage for OneDSensorCalibration { r#level_shift, r#offset_cal, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for OneDSensorCalibration { type Error = TryFromRecordError; @@ -6795,9 +11264,10 @@ impl TryFrom for OneDSensorCalibration { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct VideoFrame { - pub r#timestamp_ms: Option, - pub r#frame_number: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#frame_number: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for VideoFrame { const NAME: &'static str = "VideoFrame"; @@ -6812,17 +11282,34 @@ impl FitMessage for VideoFrame { let mut r#timestamp_ms = None; let mut r#frame_number = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#frame_number = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#frame_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("frame_number", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6834,8 +11321,12 @@ impl FitMessage for VideoFrame { r#timestamp_ms, r#frame_number, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for VideoFrame { type Error = TryFromRecordError; @@ -6845,15 +11336,16 @@ impl TryFrom for VideoFrame { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct ObdiiData { - pub r#timestamp_ms: Option, - pub r#time_offset: Option, - pub r#pid: Option, - pub r#raw_data: Option, - pub r#pid_data_size: Option, - pub r#system_time: Option, - pub r#start_timestamp: Option, - pub r#start_timestamp_ms: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#time_offset: Option, + pub r#pid: Option, + pub r#raw_data: Option, + pub r#pid_data_size: Option, + pub r#system_time: Option, + pub r#start_timestamp: Option, + pub r#start_timestamp_ms: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for ObdiiData { const NAME: &'static str = "ObdiiData"; @@ -6874,35 +11366,82 @@ impl FitMessage for ObdiiData { let mut r#start_timestamp = None; let mut r#start_timestamp_ms = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#time_offset = Some(field.into_value()); - } - 2u8 => { - r#pid = Some(field.into_value()); - } - 3u8 => { - r#raw_data = Some(field.into_value()); - } - 4u8 => { - r#pid_data_size = Some(field.into_value()); - } - 5u8 => { - r#system_time = Some(field.into_value()); - } - 6u8 => { - r#start_timestamp = Some(field.into_value()); - } - 7u8 => { - r#start_timestamp_ms = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_offset = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_offset", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pid = Some(_value); + } + Err(value) => { + invalid_fields.insert("pid", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#raw_data = Some(_value); + } + Err(value) => { + invalid_fields.insert("raw_data", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pid_data_size = Some(_value); + } + Err(value) => { + invalid_fields.insert("pid_data_size", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#system_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("system_time", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_timestamp", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_timestamp_ms", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6920,8 +11459,12 @@ impl FitMessage for ObdiiData { r#start_timestamp, r#start_timestamp_ms, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for ObdiiData { type Error = TryFromRecordError; @@ -6931,9 +11474,10 @@ impl TryFrom for ObdiiData { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct NmeaSentence { - pub r#timestamp_ms: Option, - pub r#sentence: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#sentence: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for NmeaSentence { const NAME: &'static str = "NmeaSentence"; @@ -6948,17 +11492,34 @@ impl FitMessage for NmeaSentence { let mut r#timestamp_ms = None; let mut r#sentence = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#sentence = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sentence = Some(_value); + } + Err(value) => { + invalid_fields.insert("sentence", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -6970,8 +11531,12 @@ impl FitMessage for NmeaSentence { r#timestamp_ms, r#sentence, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for NmeaSentence { type Error = TryFromRecordError; @@ -6981,18 +11546,19 @@ impl TryFrom for NmeaSentence { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct AviationAttitude { - pub r#timestamp_ms: Option, - pub r#system_time: Option, - pub r#pitch: Option, - pub r#roll: Option, - pub r#accel_lateral: Option, - pub r#accel_normal: Option, - pub r#turn_rate: Option, - pub r#stage: Option, - pub r#attitude_stage_complete: Option, - pub r#track: Option, - pub r#validity: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#system_time: Option, + pub r#pitch: Option, + pub r#roll: Option, + pub r#accel_lateral: Option, + pub r#accel_normal: Option, + pub r#turn_rate: Option, + pub r#stage: Option, + pub r#attitude_stage_complete: Option, + pub r#track: Option, + pub r#validity: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for AviationAttitude { const NAME: &'static str = "AviationAttitude"; @@ -7016,44 +11582,106 @@ impl FitMessage for AviationAttitude { let mut r#track = None; let mut r#validity = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#system_time = Some(field.into_value()); - } - 2u8 => { - r#pitch = Some(field.into_value()); - } - 3u8 => { - r#roll = Some(field.into_value()); - } - 4u8 => { - r#accel_lateral = Some(field.into_value()); - } - 5u8 => { - r#accel_normal = Some(field.into_value()); - } - 6u8 => { - r#turn_rate = Some(field.into_value()); - } - 7u8 => { - r#stage = Some(field.into_value()); - } - 8u8 => { - r#attitude_stage_complete = Some(field.into_value()); - } - 9u8 => { - r#track = Some(field.into_value()); - } - 10u8 => { - r#validity = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#system_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("system_time", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pitch = Some(_value); + } + Err(value) => { + invalid_fields.insert("pitch", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#roll = Some(_value); + } + Err(value) => { + invalid_fields.insert("roll", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#accel_lateral = Some(_value); + } + Err(value) => { + invalid_fields.insert("accel_lateral", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#accel_normal = Some(_value); + } + Err(value) => { + invalid_fields.insert("accel_normal", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#turn_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("turn_rate", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stage = Some(_value); + } + Err(value) => { + invalid_fields.insert("stage", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#attitude_stage_complete = Some(_value); + } + Err(value) => { + invalid_fields.insert("attitude_stage_complete", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#track = Some(_value); + } + Err(value) => { + invalid_fields.insert("track", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#validity = Some(_value); + } + Err(value) => { + invalid_fields.insert("validity", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -7074,8 +11702,12 @@ impl FitMessage for AviationAttitude { r#track, r#validity, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for AviationAttitude { type Error = TryFromRecordError; @@ -7085,9 +11717,10 @@ impl TryFrom for AviationAttitude { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Video { - pub r#url: Option, - pub r#hosting_provider: Option, - pub r#duration: Option, + pub r#url: Option, + pub r#hosting_provider: Option, + pub r#duration: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Video { const NAME: &'static str = "Video"; @@ -7102,17 +11735,34 @@ impl FitMessage for Video { let mut r#url = None; let mut r#hosting_provider = None; let mut r#duration = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#url = Some(field.into_value()); - } - 1u8 => { - r#hosting_provider = Some(field.into_value()); - } - 2u8 => { - r#duration = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#url = Some(_value); + } + Err(value) => { + invalid_fields.insert("url", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#hosting_provider = Some(_value); + } + Err(value) => { + invalid_fields.insert("hosting_provider", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#duration = Some(_value); + } + Err(value) => { + invalid_fields.insert("duration", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -7124,8 +11774,12 @@ impl FitMessage for Video { r#url, r#hosting_provider, r#duration, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Video { type Error = TryFromRecordError; @@ -7135,9 +11789,10 @@ impl TryFrom for Video { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct VideoTitle { - pub r#message_count: Option, - pub r#text: Option, - pub r#message_index: Option, + pub r#message_count: Option, + pub r#text: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for VideoTitle { const NAME: &'static str = "VideoTitle"; @@ -7152,17 +11807,34 @@ impl FitMessage for VideoTitle { let mut r#message_count = None; let mut r#text = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#message_count = Some(field.into_value()); - } - 1u8 => { - r#text = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_count", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#text = Some(_value); + } + Err(value) => { + invalid_fields.insert("text", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -7174,8 +11846,12 @@ impl FitMessage for VideoTitle { r#message_count, r#text, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for VideoTitle { type Error = TryFromRecordError; @@ -7185,9 +11861,10 @@ impl TryFrom for VideoTitle { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct VideoDescription { - pub r#message_count: Option, - pub r#text: Option, - pub r#message_index: Option, + pub r#message_count: Option, + pub r#text: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for VideoDescription { const NAME: &'static str = "VideoDescription"; @@ -7202,17 +11879,34 @@ impl FitMessage for VideoDescription { let mut r#message_count = None; let mut r#text = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#message_count = Some(field.into_value()); - } - 1u8 => { - r#text = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_count", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#text = Some(_value); + } + Err(value) => { + invalid_fields.insert("text", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -7224,8 +11918,12 @@ impl FitMessage for VideoDescription { r#message_count, r#text, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for VideoDescription { type Error = TryFromRecordError; @@ -7235,13 +11933,14 @@ impl TryFrom for VideoDescription { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct VideoClip { - pub r#clip_number: Option, - pub r#start_timestamp: Option, - pub r#start_timestamp_ms: Option, - pub r#end_timestamp: Option, - pub r#end_timestamp_ms: Option, - pub r#clip_start: Option, - pub r#clip_end: Option, + pub r#clip_number: Option, + pub r#start_timestamp: Option, + pub r#start_timestamp_ms: Option, + pub r#end_timestamp: Option, + pub r#end_timestamp_ms: Option, + pub r#clip_start: Option, + pub r#clip_end: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for VideoClip { const NAME: &'static str = "VideoClip"; @@ -7260,29 +11959,66 @@ impl FitMessage for VideoClip { let mut r#end_timestamp_ms = None; let mut r#clip_start = None; let mut r#clip_end = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#clip_number = Some(field.into_value()); - } - 1u8 => { - r#start_timestamp = Some(field.into_value()); - } - 2u8 => { - r#start_timestamp_ms = Some(field.into_value()); - } - 3u8 => { - r#end_timestamp = Some(field.into_value()); - } - 4u8 => { - r#end_timestamp_ms = Some(field.into_value()); - } - 6u8 => { - r#clip_start = Some(field.into_value()); - } - 7u8 => { - r#clip_end = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#clip_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("clip_number", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_timestamp", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_timestamp_ms", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_timestamp", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_timestamp_ms", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#clip_start = Some(_value); + } + Err(value) => { + invalid_fields.insert("clip_start", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#clip_end = Some(_value); + } + Err(value) => { + invalid_fields.insert("clip_end", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -7298,8 +12034,12 @@ impl FitMessage for VideoClip { r#end_timestamp_ms, r#clip_start, r#clip_end, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for VideoClip { type Error = TryFromRecordError; @@ -7309,17 +12049,18 @@ impl TryFrom for VideoClip { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Set { - pub r#duration: Option, - pub r#repetitions: Option, - pub r#weight: Option, - pub r#set_type: Option, - pub r#start_time: Option, - pub r#category: Option, - pub r#category_subtype: Option, - pub r#weight_display_unit: Option, - pub r#message_index: Option, - pub r#wkt_step_index: Option, - pub r#timestamp: Option, + pub r#duration: Option, + pub r#repetitions: Option, + pub r#weight: Option, + pub r#set_type: Option, + pub r#start_time: Option, + pub r#category: Option, + pub r#category_subtype: Option, + pub r#weight_display_unit: Option, + pub r#message_index: Option, + pub r#wkt_step_index: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Set { const NAME: &'static str = "Set"; @@ -7342,41 +12083,98 @@ impl FitMessage for Set { let mut r#message_index = None; let mut r#wkt_step_index = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#duration = Some(field.into_value()); - } - 3u8 => { - r#repetitions = Some(field.into_value()); - } - 4u8 => { - r#weight = Some(field.into_value()); - } - 5u8 => { - r#set_type = Some(field.into_value()); - } - 6u8 => { - r#start_time = Some(field.into_value()); - } - 7u8 => { - r#category = Some(field.into_value()); - } - 8u8 => { - r#category_subtype = Some(field.into_value()); - } - 9u8 => { - r#weight_display_unit = Some(field.into_value()); - } - 10u8 => { - r#message_index = Some(field.into_value()); - } - 11u8 => { - r#wkt_step_index = Some(field.into_value()); - } - 254u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#duration = Some(_value); + } + Err(value) => { + invalid_fields.insert("duration", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#repetitions = Some(_value); + } + Err(value) => { + invalid_fields.insert("repetitions", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#weight = Some(_value); + } + Err(value) => { + invalid_fields.insert("weight", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#set_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("set_type", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_time", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#category = Some(_value); + } + Err(value) => { + invalid_fields.insert("category", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#category_subtype = Some(_value); + } + Err(value) => { + invalid_fields.insert("category_subtype", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#weight_display_unit = Some(_value); + } + Err(value) => { + invalid_fields.insert("weight_display_unit", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#wkt_step_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("wkt_step_index", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -7396,8 +12194,12 @@ impl FitMessage for Set { r#message_index, r#wkt_step_index, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Set { type Error = TryFromRecordError; @@ -7407,16 +12209,17 @@ impl TryFrom for Set { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Jump { - pub r#distance: Option, - pub r#height: Option, - pub r#rotations: Option, - pub r#hang_time: Option, - pub r#score: Option, - pub r#position_lat: Option, - pub r#position_long: Option, - pub r#speed: Option, - pub r#enhanced_speed: Option, - pub r#timestamp: Option, + pub r#distance: Option, + pub r#height: Option, + pub r#rotations: Option, + pub r#hang_time: Option, + pub r#score: Option, + pub r#position_lat: Option, + pub r#position_long: Option, + pub r#speed: Option, + pub r#enhanced_speed: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Jump { const NAME: &'static str = "Jump"; @@ -7438,38 +12241,90 @@ impl FitMessage for Jump { let mut r#speed = None; let mut r#enhanced_speed = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#distance = Some(field.into_value()); - } - 1u8 => { - r#height = Some(field.into_value()); - } - 2u8 => { - r#rotations = Some(field.into_value()); - } - 3u8 => { - r#hang_time = Some(field.into_value()); - } - 4u8 => { - r#score = Some(field.into_value()); - } - 5u8 => { - r#position_lat = Some(field.into_value()); - } - 6u8 => { - r#position_long = Some(field.into_value()); - } - 7u8 => { - r#speed = Some(field.into_value()); - } - 8u8 => { - r#enhanced_speed = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("distance", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#height = Some(_value); + } + Err(value) => { + invalid_fields.insert("height", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#rotations = Some(_value); + } + Err(value) => { + invalid_fields.insert("rotations", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#hang_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("hang_time", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#score = Some(_value); + } + Err(value) => { + invalid_fields.insert("score", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_lat", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_long", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("speed", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_speed", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -7488,8 +12343,12 @@ impl FitMessage for Jump { r#speed, r#enhanced_speed, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Jump { type Error = TryFromRecordError; @@ -7499,25 +12358,26 @@ impl TryFrom for Jump { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Split { - pub r#split_type: Option, - pub r#total_elapsed_time: Option, - pub r#total_timer_time: Option, - pub r#total_distance: Option, - pub r#avg_speed: Option, - pub r#start_time: Option, - pub r#total_ascent: Option, - pub r#total_descent: Option, - pub r#start_position_lat: Option, - pub r#start_position_long: Option, - pub r#end_position_lat: Option, - pub r#end_position_long: Option, - pub r#max_speed: Option, - pub r#avg_vert_speed: Option, - pub r#end_time: Option, - pub r#total_calories: Option, - pub r#start_elevation: Option, - pub r#total_moving_time: Option, - pub r#message_index: Option, + pub r#split_type: Option, + pub r#total_elapsed_time: Option, + pub r#total_timer_time: Option, + pub r#total_distance: Option, + pub r#avg_speed: Option, + pub r#start_time: Option, + pub r#total_ascent: Option, + pub r#total_descent: Option, + pub r#start_position_lat: Option, + pub r#start_position_long: Option, + pub r#end_position_lat: Option, + pub r#end_position_long: Option, + pub r#max_speed: Option, + pub r#avg_vert_speed: Option, + pub r#end_time: Option, + pub r#total_calories: Option, + pub r#start_elevation: Option, + pub r#total_moving_time: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Split { const NAME: &'static str = "Split"; @@ -7548,65 +12408,162 @@ impl FitMessage for Split { let mut r#start_elevation = None; let mut r#total_moving_time = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#split_type = Some(field.into_value()); - } - 1u8 => { - r#total_elapsed_time = Some(field.into_value()); - } - 2u8 => { - r#total_timer_time = Some(field.into_value()); - } - 3u8 => { - r#total_distance = Some(field.into_value()); - } - 4u8 => { - r#avg_speed = Some(field.into_value()); - } - 9u8 => { - r#start_time = Some(field.into_value()); - } - 13u8 => { - r#total_ascent = Some(field.into_value()); - } - 14u8 => { - r#total_descent = Some(field.into_value()); - } - 21u8 => { - r#start_position_lat = Some(field.into_value()); - } - 22u8 => { - r#start_position_long = Some(field.into_value()); - } - 23u8 => { - r#end_position_lat = Some(field.into_value()); - } - 24u8 => { - r#end_position_long = Some(field.into_value()); - } - 25u8 => { - r#max_speed = Some(field.into_value()); - } - 26u8 => { - r#avg_vert_speed = Some(field.into_value()); - } - 27u8 => { - r#end_time = Some(field.into_value()); - } - 28u8 => { - r#total_calories = Some(field.into_value()); - } - 74u8 => { - r#start_elevation = Some(field.into_value()); - } - 110u8 => { - r#total_moving_time = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#split_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("split_type", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_elapsed_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_elapsed_time", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_timer_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_timer_time", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_distance", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_speed", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_time", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_ascent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_ascent", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_descent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_descent", value); + } + }, + 21u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_position_lat", value); + } + }, + 22u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_position_long", value); + } + }, + 23u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_position_lat", value); + } + }, + 24u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_position_long", value); + } + }, + 25u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_speed", value); + } + }, + 26u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_vert_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_vert_speed", value); + } + }, + 27u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_time", value); + } + }, + 28u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_calories", value); + } + }, + 74u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_elevation = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_elevation", value); + } + }, + 110u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_moving_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_moving_time", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -7634,8 +12591,12 @@ impl FitMessage for Split { r#start_elevation, r#total_moving_time, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Split { type Error = TryFromRecordError; @@ -7645,20 +12606,21 @@ impl TryFrom for Split { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct SplitSummary { - pub r#split_type: Option, - pub r#num_splits: Option, - pub r#total_timer_time: Option, - pub r#total_distance: Option, - pub r#avg_speed: Option, - pub r#max_speed: Option, - pub r#total_ascent: Option, - pub r#total_descent: Option, - pub r#avg_heart_rate: Option, - pub r#max_heart_rate: Option, - pub r#avg_vert_speed: Option, - pub r#total_calories: Option, - pub r#total_moving_time: Option, - pub r#message_index: Option, + pub r#split_type: Option, + pub r#num_splits: Option, + pub r#total_timer_time: Option, + pub r#total_distance: Option, + pub r#avg_speed: Option, + pub r#max_speed: Option, + pub r#total_ascent: Option, + pub r#total_descent: Option, + pub r#avg_heart_rate: Option, + pub r#max_heart_rate: Option, + pub r#avg_vert_speed: Option, + pub r#total_calories: Option, + pub r#total_moving_time: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for SplitSummary { const NAME: &'static str = "SplitSummary"; @@ -7684,50 +12646,122 @@ impl FitMessage for SplitSummary { let mut r#total_calories = None; let mut r#total_moving_time = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#split_type = Some(field.into_value()); - } - 3u8 => { - r#num_splits = Some(field.into_value()); - } - 4u8 => { - r#total_timer_time = Some(field.into_value()); - } - 5u8 => { - r#total_distance = Some(field.into_value()); - } - 6u8 => { - r#avg_speed = Some(field.into_value()); - } - 7u8 => { - r#max_speed = Some(field.into_value()); - } - 8u8 => { - r#total_ascent = Some(field.into_value()); - } - 9u8 => { - r#total_descent = Some(field.into_value()); - } - 10u8 => { - r#avg_heart_rate = Some(field.into_value()); - } - 11u8 => { - r#max_heart_rate = Some(field.into_value()); - } - 12u8 => { - r#avg_vert_speed = Some(field.into_value()); - } - 13u8 => { - r#total_calories = Some(field.into_value()); - } - 77u8 => { - r#total_moving_time = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#split_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("split_type", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#num_splits = Some(_value); + } + Err(value) => { + invalid_fields.insert("num_splits", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_timer_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_timer_time", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_distance", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_speed", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_speed", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_ascent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_ascent", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_descent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_descent", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_heart_rate", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_heart_rate", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_vert_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_vert_speed", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_calories", value); + } + }, + 77u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_moving_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_moving_time", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -7750,8 +12784,12 @@ impl FitMessage for SplitSummary { r#total_calories, r#total_moving_time, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for SplitSummary { type Error = TryFromRecordError; @@ -7761,13 +12799,14 @@ impl TryFrom for SplitSummary { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct ClimbPro { - pub r#position_lat: Option, - pub r#position_long: Option, - pub r#climb_pro_event: Option, - pub r#climb_number: Option, - pub r#climb_category: Option, - pub r#current_dist: Option, - pub r#timestamp: Option, + pub r#position_lat: Option, + pub r#position_long: Option, + pub r#climb_pro_event: Option, + pub r#climb_number: Option, + pub r#climb_category: Option, + pub r#current_dist: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for ClimbPro { const NAME: &'static str = "ClimbPro"; @@ -7786,29 +12825,66 @@ impl FitMessage for ClimbPro { let mut r#climb_category = None; let mut r#current_dist = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#position_lat = Some(field.into_value()); - } - 1u8 => { - r#position_long = Some(field.into_value()); - } - 2u8 => { - r#climb_pro_event = Some(field.into_value()); - } - 3u8 => { - r#climb_number = Some(field.into_value()); - } - 4u8 => { - r#climb_category = Some(field.into_value()); - } - 5u8 => { - r#current_dist = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_lat", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_long", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#climb_pro_event = Some(_value); + } + Err(value) => { + invalid_fields.insert("climb_pro_event", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#climb_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("climb_number", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#climb_category = Some(_value); + } + Err(value) => { + invalid_fields.insert("climb_category", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#current_dist = Some(_value); + } + Err(value) => { + invalid_fields.insert("current_dist", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -7824,8 +12900,12 @@ impl FitMessage for ClimbPro { r#climb_category, r#current_dist, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for ClimbPro { type Error = TryFromRecordError; @@ -7836,20 +12916,21 @@ impl TryFrom for ClimbPro { #[doc = "Must be logged before developer field is used"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct FieldDescription { - pub r#developer_data_index: Option, - pub r#field_definition_number: Option, - pub r#fit_base_type_id: Option, - pub r#field_name: Option, - pub r#array: Option, - pub r#components: Option, - pub r#scale: Option, - pub r#offset: Option, - pub r#units: Option, - pub r#bits: Option, - pub r#accumulate: Option, - pub r#fit_base_unit_id: Option, - pub r#native_mesg_num: Option, - pub r#native_field_num: Option, + pub r#developer_data_index: Option, + pub r#field_definition_number: Option, + pub r#fit_base_type_id: Option, + pub r#field_name: Option, + pub r#array: Option, + pub r#components: Option, + pub r#scale: Option, + pub r#offset: Option, + pub r#units: Option, + pub r#bits: Option, + pub r#accumulate: Option, + pub r#fit_base_unit_id: Option, + pub r#native_mesg_num: Option, + pub r#native_field_num: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for FieldDescription { const NAME: &'static str = "FieldDescription"; @@ -7875,50 +12956,122 @@ impl FitMessage for FieldDescription { let mut r#fit_base_unit_id = None; let mut r#native_mesg_num = None; let mut r#native_field_num = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#developer_data_index = Some(field.into_value()); - } - 1u8 => { - r#field_definition_number = Some(field.into_value()); - } - 2u8 => { - r#fit_base_type_id = Some(field.into_value()); - } - 3u8 => { - r#field_name = Some(field.into_value()); - } - 4u8 => { - r#array = Some(field.into_value()); - } - 5u8 => { - r#components = Some(field.into_value()); - } - 6u8 => { - r#scale = Some(field.into_value()); - } - 7u8 => { - r#offset = Some(field.into_value()); - } - 8u8 => { - r#units = Some(field.into_value()); - } - 9u8 => { - r#bits = Some(field.into_value()); - } - 10u8 => { - r#accumulate = Some(field.into_value()); - } - 13u8 => { - r#fit_base_unit_id = Some(field.into_value()); - } - 14u8 => { - r#native_mesg_num = Some(field.into_value()); - } - 15u8 => { - r#native_field_num = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#developer_data_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("developer_data_index", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#field_definition_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("field_definition_number", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#fit_base_type_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("fit_base_type_id", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#field_name = Some(_value); + } + Err(value) => { + invalid_fields.insert("field_name", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#array = Some(_value); + } + Err(value) => { + invalid_fields.insert("array", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#components = Some(_value); + } + Err(value) => { + invalid_fields.insert("components", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#scale = Some(_value); + } + Err(value) => { + invalid_fields.insert("scale", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#offset = Some(_value); + } + Err(value) => { + invalid_fields.insert("offset", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#units = Some(_value); + } + Err(value) => { + invalid_fields.insert("units", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bits = Some(_value); + } + Err(value) => { + invalid_fields.insert("bits", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#accumulate = Some(_value); + } + Err(value) => { + invalid_fields.insert("accumulate", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#fit_base_unit_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("fit_base_unit_id", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#native_mesg_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("native_mesg_num", value); + } + }, + 15u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#native_field_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("native_field_num", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -7941,8 +13094,12 @@ impl FitMessage for FieldDescription { r#fit_base_unit_id, r#native_mesg_num, r#native_field_num, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for FieldDescription { type Error = TryFromRecordError; @@ -7953,11 +13110,12 @@ impl TryFrom for FieldDescription { #[doc = "Must be logged before field description"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct DeveloperDataId { - pub r#developer_id: Option, - pub r#application_id: Option, - pub r#manufacturer_id: Option, - pub r#developer_data_index: Option, - pub r#application_version: Option, + pub r#developer_id: Option, + pub r#application_id: Option, + pub r#manufacturer_id: Option, + pub r#developer_data_index: Option, + pub r#application_version: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for DeveloperDataId { const NAME: &'static str = "DeveloperDataId"; @@ -7974,23 +13132,50 @@ impl FitMessage for DeveloperDataId { let mut r#manufacturer_id = None; let mut r#developer_data_index = None; let mut r#application_version = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#developer_id = Some(field.into_value()); - } - 1u8 => { - r#application_id = Some(field.into_value()); - } - 2u8 => { - r#manufacturer_id = Some(field.into_value()); - } - 3u8 => { - r#developer_data_index = Some(field.into_value()); - } - 4u8 => { - r#application_version = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#developer_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("developer_id", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#application_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("application_id", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#manufacturer_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("manufacturer_id", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#developer_data_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("developer_data_index", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#application_version = Some(_value); + } + Err(value) => { + invalid_fields.insert("application_version", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -8004,8 +13189,12 @@ impl FitMessage for DeveloperDataId { r#manufacturer_id, r#developer_data_index, r#application_version, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for DeveloperDataId { type Error = TryFromRecordError; @@ -8015,10 +13204,11 @@ impl TryFrom for DeveloperDataId { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Course { - pub r#sport: Option, - pub r#name: Option, - pub r#capabilities: Option, - pub r#sub_sport: Option, + pub r#sport: Option, + pub r#name: Option, + pub r#capabilities: Option, + pub r#sub_sport: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Course { const NAME: &'static str = "Course"; @@ -8033,21 +13223,43 @@ impl FitMessage for Course { let mut r#sport = None; let mut r#name = None; let mut r#capabilities = None; - let mut r#sub_sport = None; - for field in record.into_vec() { - match field.number() { - 4u8 => { - r#sport = Some(field.into_value()); - } - 5u8 => { - r#name = Some(field.into_value()); - } - 6u8 => { - r#capabilities = Some(field.into_value()); - } - 7u8 => { - r#sub_sport = Some(field.into_value()); - } + let mut r#sub_sport = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); + for field in record.into_vec() { + match field.number() { + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#capabilities = Some(_value); + } + Err(value) => { + invalid_fields.insert("capabilities", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sub_sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sub_sport", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -8060,8 +13272,12 @@ impl FitMessage for Course { r#name, r#capabilities, r#sub_sport, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Course { type Error = TryFromRecordError; @@ -8071,14 +13287,15 @@ impl TryFrom for Course { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct CoursePoint { - pub r#timestamp: Option, - pub r#position_lat: Option, - pub r#position_long: Option, - pub r#distance: Option, - pub r#type: Option, - pub r#name: Option, - pub r#favorite: Option, - pub r#message_index: Option, + pub r#timestamp: Option, + pub r#position_lat: Option, + pub r#position_long: Option, + pub r#distance: Option, + pub r#type: Option, + pub r#name: Option, + pub r#favorite: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for CoursePoint { const NAME: &'static str = "CoursePoint"; @@ -8098,32 +13315,74 @@ impl FitMessage for CoursePoint { let mut r#name = None; let mut r#favorite = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 1u8 => { - r#timestamp = Some(field.into_value()); - } - 2u8 => { - r#position_lat = Some(field.into_value()); - } - 3u8 => { - r#position_long = Some(field.into_value()); - } - 4u8 => { - r#distance = Some(field.into_value()); - } - 5u8 => { - r#type = Some(field.into_value()); - } - 6u8 => { - r#name = Some(field.into_value()); - } - 8u8 => { - r#favorite = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_lat", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_long", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("distance", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#type = Some(_value); + } + Err(value) => { + invalid_fields.insert("type", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#favorite = Some(_value); + } + Err(value) => { + invalid_fields.insert("favorite", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -8140,8 +13399,12 @@ impl FitMessage for CoursePoint { r#name, r#favorite, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for CoursePoint { type Error = TryFromRecordError; @@ -8152,15 +13415,16 @@ impl TryFrom for CoursePoint { #[doc = "Unique Identification data for a segment file"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct SegmentId { - pub r#name: Option, - pub r#uuid: Option, - pub r#sport: Option, - pub r#enabled: Option, - pub r#user_profile_primary_key: Option, - pub r#device_id: Option, - pub r#default_race_leader: Option, - pub r#delete_status: Option, - pub r#selection_type: Option, + pub r#name: Option, + pub r#uuid: Option, + pub r#sport: Option, + pub r#enabled: Option, + pub r#user_profile_primary_key: Option, + pub r#device_id: Option, + pub r#default_race_leader: Option, + pub r#delete_status: Option, + pub r#selection_type: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for SegmentId { const NAME: &'static str = "SegmentId"; @@ -8181,35 +13445,82 @@ impl FitMessage for SegmentId { let mut r#default_race_leader = None; let mut r#delete_status = None; let mut r#selection_type = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#name = Some(field.into_value()); - } - 1u8 => { - r#uuid = Some(field.into_value()); - } - 2u8 => { - r#sport = Some(field.into_value()); - } - 3u8 => { - r#enabled = Some(field.into_value()); - } - 4u8 => { - r#user_profile_primary_key = Some(field.into_value()); - } - 5u8 => { - r#device_id = Some(field.into_value()); - } - 6u8 => { - r#default_race_leader = Some(field.into_value()); - } - 7u8 => { - r#delete_status = Some(field.into_value()); - } - 8u8 => { - r#selection_type = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#uuid = Some(_value); + } + Err(value) => { + invalid_fields.insert("uuid", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("enabled", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#user_profile_primary_key = Some(_value); + } + Err(value) => { + invalid_fields.insert("user_profile_primary_key", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#device_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("device_id", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#default_race_leader = Some(_value); + } + Err(value) => { + invalid_fields.insert("default_race_leader", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#delete_status = Some(_value); + } + Err(value) => { + invalid_fields.insert("delete_status", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#selection_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("selection_type", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -8227,8 +13538,12 @@ impl FitMessage for SegmentId { r#default_race_leader, r#delete_status, r#selection_type, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for SegmentId { type Error = TryFromRecordError; @@ -8239,13 +13554,14 @@ impl TryFrom for SegmentId { #[doc = "Unique Identification data for an individual segment leader within a segment file"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct SegmentLeaderboardEntry { - pub r#name: Option, - pub r#type: Option, - pub r#group_primary_key: Option, - pub r#activity_id: Option, - pub r#segment_time: Option, - pub r#activity_id_string: Option, - pub r#message_index: Option, + pub r#name: Option, + pub r#type: Option, + pub r#group_primary_key: Option, + pub r#activity_id: Option, + pub r#segment_time: Option, + pub r#activity_id_string: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for SegmentLeaderboardEntry { const NAME: &'static str = "SegmentLeaderboardEntry"; @@ -8264,618 +13580,1179 @@ impl FitMessage for SegmentLeaderboardEntry { let mut r#segment_time = None; let mut r#activity_id_string = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); + for field in record.into_vec() { + match field.number() { + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#type = Some(_value); + } + Err(value) => { + invalid_fields.insert("type", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#group_primary_key = Some(_value); + } + Err(value) => { + invalid_fields.insert("group_primary_key", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#activity_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("activity_id", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#segment_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("segment_time", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#activity_id_string = Some(_value); + } + Err(value) => { + invalid_fields.insert("activity_id_string", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, + _ => { + if !options.ignore_unexpected_fields { + return Err(TryFromRecordError::unexpected_field(&field)); + } + } + } + } + Ok(Self { + r#name, + r#type, + r#group_primary_key, + r#activity_id, + r#segment_time, + r#activity_id_string, + r#message_index, + invalid_fields, + }) + } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } +} +impl TryFrom for SegmentLeaderboardEntry { + type Error = TryFromRecordError; + fn try_from(record: FitDataRecord) -> Result { + Self::parse(record) + } +} +#[doc = "Navigation and race evaluation point for a segment decribing a point along the segment path and time it took each segment leader to reach that point"] +#[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] +pub struct SegmentPoint { + pub r#position_lat: Option, + pub r#position_long: Option, + pub r#distance: Option, + pub r#altitude: Option, + pub r#leader_time: Option, + pub r#enhanced_altitude: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, +} +impl FitMessage for SegmentPoint { + const NAME: &'static str = "SegmentPoint"; + const KIND: MesgNum = MesgNum::SegmentPoint; + fn parse_with_options( + record: FitDataRecord, + options: MessageParseOptions, + ) -> Result { + if record.kind() != Self::KIND { + return Err(TryFromRecordError::unexpected_message_kind::(&record)); + } + let mut r#position_lat = None; + let mut r#position_long = None; + let mut r#distance = None; + let mut r#altitude = None; + let mut r#leader_time = None; + let mut r#enhanced_altitude = None; + let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); + for field in record.into_vec() { + match field.number() { + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_lat", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("position_long", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("distance", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("altitude", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#leader_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("leader_time", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_altitude", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, + _ => { + if !options.ignore_unexpected_fields { + return Err(TryFromRecordError::unexpected_field(&field)); + } + } + } + } + Ok(Self { + r#position_lat, + r#position_long, + r#distance, + r#altitude, + r#leader_time, + r#enhanced_altitude, + r#message_index, + invalid_fields, + }) + } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } +} +impl TryFrom for SegmentPoint { + type Error = TryFromRecordError; + fn try_from(record: FitDataRecord) -> Result { + Self::parse(record) + } +} +#[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] +pub struct SegmentLap { + pub r#event: Option, + pub r#event_type: Option, + pub r#start_time: Option, + pub r#start_position_lat: Option, + pub r#start_position_long: Option, + pub r#end_position_lat: Option, + pub r#end_position_long: Option, + pub r#total_elapsed_time: Option, + pub r#total_timer_time: Option, + pub r#total_distance: Option, + pub r#total_cycles: Option, + pub r#total_calories: Option, + pub r#total_fat_calories: Option, + pub r#avg_speed: Option, + pub r#max_speed: Option, + pub r#avg_heart_rate: Option, + pub r#max_heart_rate: Option, + pub r#avg_cadence: Option, + pub r#max_cadence: Option, + pub r#avg_power: Option, + pub r#max_power: Option, + pub r#total_ascent: Option, + pub r#total_descent: Option, + pub r#sport: Option, + pub r#event_group: Option, + pub r#nec_lat: Option, + pub r#nec_long: Option, + pub r#swc_lat: Option, + pub r#swc_long: Option, + pub r#name: Option, + pub r#normalized_power: Option, + pub r#left_right_balance: Option, + pub r#sub_sport: Option, + pub r#total_work: Option, + pub r#avg_altitude: Option, + pub r#max_altitude: Option, + pub r#gps_accuracy: Option, + pub r#avg_grade: Option, + pub r#avg_pos_grade: Option, + pub r#avg_neg_grade: Option, + pub r#max_pos_grade: Option, + pub r#max_neg_grade: Option, + pub r#avg_temperature: Option, + pub r#max_temperature: Option, + pub r#total_moving_time: Option, + pub r#avg_pos_vertical_speed: Option, + pub r#avg_neg_vertical_speed: Option, + pub r#max_pos_vertical_speed: Option, + pub r#max_neg_vertical_speed: Option, + pub r#time_in_hr_zone: Option, + pub r#time_in_speed_zone: Option, + pub r#time_in_cadence_zone: Option, + pub r#time_in_power_zone: Option, + pub r#repetition_num: Option, + pub r#min_altitude: Option, + pub r#min_heart_rate: Option, + pub r#active_time: Option, + pub r#wkt_step_index: Option, + pub r#sport_event: Option, + pub r#avg_left_torque_effectiveness: Option, + pub r#avg_right_torque_effectiveness: Option, + pub r#avg_left_pedal_smoothness: Option, + pub r#avg_right_pedal_smoothness: Option, + pub r#avg_combined_pedal_smoothness: Option, + pub r#status: Option, + pub r#uuid: Option, + pub r#avg_fractional_cadence: Option, + pub r#max_fractional_cadence: Option, + pub r#total_fractional_cycles: Option, + pub r#front_gear_shift_count: Option, + pub r#rear_gear_shift_count: Option, + pub r#time_standing: Option, + pub r#stand_count: Option, + pub r#avg_left_pco: Option, + pub r#avg_right_pco: Option, + pub r#avg_left_power_phase: Option, + pub r#avg_left_power_phase_peak: Option, + pub r#avg_right_power_phase: Option, + pub r#avg_right_power_phase_peak: Option, + pub r#avg_power_position: Option, + pub r#max_power_position: Option, + pub r#avg_cadence_position: Option, + pub r#max_cadence_position: Option, + pub r#manufacturer: Option, + pub r#total_grit: Option, + pub r#total_flow: Option, + pub r#avg_grit: Option, + pub r#avg_flow: Option, + pub r#total_fractional_ascent: Option, + pub r#total_fractional_descent: Option, + pub r#enhanced_avg_altitude: Option, + pub r#enhanced_max_altitude: Option, + pub r#enhanced_min_altitude: Option, + pub r#timestamp: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, +} +impl FitMessage for SegmentLap { + const NAME: &'static str = "SegmentLap"; + const KIND: MesgNum = MesgNum::SegmentLap; + fn parse_with_options( + record: FitDataRecord, + options: MessageParseOptions, + ) -> Result { + if record.kind() != Self::KIND { + return Err(TryFromRecordError::unexpected_message_kind::(&record)); + } + let mut r#event = None; + let mut r#event_type = None; + let mut r#start_time = None; + let mut r#start_position_lat = None; + let mut r#start_position_long = None; + let mut r#end_position_lat = None; + let mut r#end_position_long = None; + let mut r#total_elapsed_time = None; + let mut r#total_timer_time = None; + let mut r#total_distance = None; + let mut r#total_cycles = None; + let mut r#total_calories = None; + let mut r#total_fat_calories = None; + let mut r#avg_speed = None; + let mut r#max_speed = None; + let mut r#avg_heart_rate = None; + let mut r#max_heart_rate = None; + let mut r#avg_cadence = None; + let mut r#max_cadence = None; + let mut r#avg_power = None; + let mut r#max_power = None; + let mut r#total_ascent = None; + let mut r#total_descent = None; + let mut r#sport = None; + let mut r#event_group = None; + let mut r#nec_lat = None; + let mut r#nec_long = None; + let mut r#swc_lat = None; + let mut r#swc_long = None; + let mut r#name = None; + let mut r#normalized_power = None; + let mut r#left_right_balance = None; + let mut r#sub_sport = None; + let mut r#total_work = None; + let mut r#avg_altitude = None; + let mut r#max_altitude = None; + let mut r#gps_accuracy = None; + let mut r#avg_grade = None; + let mut r#avg_pos_grade = None; + let mut r#avg_neg_grade = None; + let mut r#max_pos_grade = None; + let mut r#max_neg_grade = None; + let mut r#avg_temperature = None; + let mut r#max_temperature = None; + let mut r#total_moving_time = None; + let mut r#avg_pos_vertical_speed = None; + let mut r#avg_neg_vertical_speed = None; + let mut r#max_pos_vertical_speed = None; + let mut r#max_neg_vertical_speed = None; + let mut r#time_in_hr_zone = None; + let mut r#time_in_speed_zone = None; + let mut r#time_in_cadence_zone = None; + let mut r#time_in_power_zone = None; + let mut r#repetition_num = None; + let mut r#min_altitude = None; + let mut r#min_heart_rate = None; + let mut r#active_time = None; + let mut r#wkt_step_index = None; + let mut r#sport_event = None; + let mut r#avg_left_torque_effectiveness = None; + let mut r#avg_right_torque_effectiveness = None; + let mut r#avg_left_pedal_smoothness = None; + let mut r#avg_right_pedal_smoothness = None; + let mut r#avg_combined_pedal_smoothness = None; + let mut r#status = None; + let mut r#uuid = None; + let mut r#avg_fractional_cadence = None; + let mut r#max_fractional_cadence = None; + let mut r#total_fractional_cycles = None; + let mut r#front_gear_shift_count = None; + let mut r#rear_gear_shift_count = None; + let mut r#time_standing = None; + let mut r#stand_count = None; + let mut r#avg_left_pco = None; + let mut r#avg_right_pco = None; + let mut r#avg_left_power_phase = None; + let mut r#avg_left_power_phase_peak = None; + let mut r#avg_right_power_phase = None; + let mut r#avg_right_power_phase_peak = None; + let mut r#avg_power_position = None; + let mut r#max_power_position = None; + let mut r#avg_cadence_position = None; + let mut r#max_cadence_position = None; + let mut r#manufacturer = None; + let mut r#total_grit = None; + let mut r#total_flow = None; + let mut r#avg_grit = None; + let mut r#avg_flow = None; + let mut r#total_fractional_ascent = None; + let mut r#total_fractional_descent = None; + let mut r#enhanced_avg_altitude = None; + let mut r#enhanced_max_altitude = None; + let mut r#enhanced_min_altitude = None; + let mut r#timestamp = None; + let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#name = Some(field.into_value()); - } - 1u8 => { - r#type = Some(field.into_value()); - } - 2u8 => { - r#group_primary_key = Some(field.into_value()); - } - 3u8 => { - r#activity_id = Some(field.into_value()); - } - 4u8 => { - r#segment_time = Some(field.into_value()); - } - 5u8 => { - r#activity_id_string = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } - _ => { - if !options.ignore_unexpected_fields { - return Err(TryFromRecordError::unexpected_field(&field)); + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event = Some(_value); } - } - } - } - Ok(Self { - r#name, - r#type, - r#group_primary_key, - r#activity_id, - r#segment_time, - r#activity_id_string, - r#message_index, - }) - } -} -impl TryFrom for SegmentLeaderboardEntry { - type Error = TryFromRecordError; - fn try_from(record: FitDataRecord) -> Result { - Self::parse(record) - } -} -#[doc = "Navigation and race evaluation point for a segment decribing a point along the segment path and time it took each segment leader to reach that point"] -#[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] -pub struct SegmentPoint { - pub r#position_lat: Option, - pub r#position_long: Option, - pub r#distance: Option, - pub r#altitude: Option, - pub r#leader_time: Option, - pub r#enhanced_altitude: Option, - pub r#message_index: Option, -} -impl FitMessage for SegmentPoint { - const NAME: &'static str = "SegmentPoint"; - const KIND: MesgNum = MesgNum::SegmentPoint; - fn parse_with_options( - record: FitDataRecord, - options: MessageParseOptions, - ) -> Result { - if record.kind() != Self::KIND { - return Err(TryFromRecordError::unexpected_message_kind::(&record)); - } - let mut r#position_lat = None; - let mut r#position_long = None; - let mut r#distance = None; - let mut r#altitude = None; - let mut r#leader_time = None; - let mut r#enhanced_altitude = None; - let mut r#message_index = None; - for field in record.into_vec() { - match field.number() { - 1u8 => { - r#position_lat = Some(field.into_value()); - } - 2u8 => { - r#position_long = Some(field.into_value()); - } - 3u8 => { - r#distance = Some(field.into_value()); - } - 4u8 => { - r#altitude = Some(field.into_value()); - } - 5u8 => { - r#leader_time = Some(field.into_value()); - } - 6u8 => { - r#enhanced_altitude = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } - _ => { - if !options.ignore_unexpected_fields { - return Err(TryFromRecordError::unexpected_field(&field)); + Err(value) => { + invalid_fields.insert("event", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_type", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_time", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_position_lat", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_position_long", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_position_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_position_lat", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_position_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_position_long", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_elapsed_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_elapsed_time", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_timer_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_timer_time", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_distance", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_cycles = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_cycles", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_calories", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_fat_calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_fat_calories", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_speed", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_speed", value); + } + }, + 15u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_heart_rate", value); + } + }, + 16u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_heart_rate", value); + } + }, + 17u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_cadence", value); + } + }, + 18u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_cadence", value); + } + }, + 19u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_power", value); + } + }, + 20u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_power", value); + } + }, + 21u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_ascent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_ascent", value); + } + }, + 22u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_descent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_descent", value); + } + }, + 23u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport", value); + } + }, + 24u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_group = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_group", value); + } + }, + 25u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#nec_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("nec_lat", value); + } + }, + 26u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#nec_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("nec_long", value); + } + }, + 27u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#swc_lat = Some(_value); + } + Err(value) => { + invalid_fields.insert("swc_lat", value); + } + }, + 28u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#swc_long = Some(_value); + } + Err(value) => { + invalid_fields.insert("swc_long", value); + } + }, + 29u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#name = Some(_value); + } + Err(value) => { + invalid_fields.insert("name", value); + } + }, + 30u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#normalized_power = Some(_value); + } + Err(value) => { + invalid_fields.insert("normalized_power", value); + } + }, + 31u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#left_right_balance = Some(_value); + } + Err(value) => { + invalid_fields.insert("left_right_balance", value); + } + }, + 32u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sub_sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sub_sport", value); + } + }, + 33u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_work = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_work", value); + } + }, + 34u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_altitude", value); + } + }, + 35u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_altitude", value); + } + }, + 36u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gps_accuracy = Some(_value); + } + Err(value) => { + invalid_fields.insert("gps_accuracy", value); + } + }, + 37u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_grade", value); + } + }, + 38u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_pos_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_pos_grade", value); + } + }, + 39u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_neg_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_neg_grade", value); + } + }, + 40u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_pos_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_pos_grade", value); + } + }, + 41u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_neg_grade = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_neg_grade", value); + } + }, + 42u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_temperature", value); + } + }, + 43u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_temperature", value); + } + }, + 44u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_moving_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_moving_time", value); + } + }, + 45u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_pos_vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_pos_vertical_speed", value); + } + }, + 46u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_neg_vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_neg_vertical_speed", value); + } + }, + 47u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_pos_vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_pos_vertical_speed", value); + } + }, + 48u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_neg_vertical_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_neg_vertical_speed", value); + } + }, + 49u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_hr_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_hr_zone", value); + } + }, + 50u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_speed_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_speed_zone", value); + } + }, + 51u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_cadence_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_cadence_zone", value); + } + }, + 52u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_in_power_zone = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_in_power_zone", value); + } + }, + 53u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#repetition_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("repetition_num", value); + } + }, + 54u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_altitude", value); + } + }, + 55u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_heart_rate", value); + } + }, + 56u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#active_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("active_time", value); + } + }, + 57u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#wkt_step_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("wkt_step_index", value); + } + }, + 58u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport_event = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport_event", value); + } + }, + 59u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_torque_effectiveness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_torque_effectiveness", value); + } + }, + 60u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_torque_effectiveness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_torque_effectiveness", value); + } + }, + 61u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_pedal_smoothness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_pedal_smoothness", value); + } + }, + 62u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_pedal_smoothness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_pedal_smoothness", value); + } + }, + 63u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_combined_pedal_smoothness = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_combined_pedal_smoothness", value); + } + }, + 64u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#status = Some(_value); + } + Err(value) => { + invalid_fields.insert("status", value); + } + }, + 65u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#uuid = Some(_value); + } + Err(value) => { + invalid_fields.insert("uuid", value); + } + }, + 66u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_fractional_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_fractional_cadence", value); + } + }, + 67u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_fractional_cadence = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_fractional_cadence", value); + } + }, + 68u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_fractional_cycles = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_fractional_cycles", value); + } + }, + 69u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#front_gear_shift_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("front_gear_shift_count", value); + } + }, + 70u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#rear_gear_shift_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("rear_gear_shift_count", value); + } + }, + 71u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_standing = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_standing", value); + } + }, + 72u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stand_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("stand_count", value); + } + }, + 73u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_pco = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_pco", value); + } + }, + 74u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_pco = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_pco", value); + } + }, + 75u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_power_phase = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_power_phase", value); + } + }, + 76u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_left_power_phase_peak = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_left_power_phase_peak", value); + } + }, + 77u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_power_phase = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_power_phase", value); + } + }, + 78u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_right_power_phase_peak = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_right_power_phase_peak", value); + } + }, + 79u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_power_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_power_position", value); + } + }, + 80u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_power_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_power_position", value); + } + }, + 81u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_cadence_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_cadence_position", value); + } + }, + 82u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_cadence_position = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_cadence_position", value); + } + }, + 83u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#manufacturer = Some(_value); + } + Err(value) => { + invalid_fields.insert("manufacturer", value); + } + }, + 84u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_grit = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_grit", value); + } + }, + 85u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_flow = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_flow", value); + } + }, + 86u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_grit = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_grit", value); + } + }, + 87u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_flow = Some(_value); } - } - } - } - Ok(Self { - r#position_lat, - r#position_long, - r#distance, - r#altitude, - r#leader_time, - r#enhanced_altitude, - r#message_index, - }) - } -} -impl TryFrom for SegmentPoint { - type Error = TryFromRecordError; - fn try_from(record: FitDataRecord) -> Result { - Self::parse(record) - } -} -#[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] -pub struct SegmentLap { - pub r#event: Option, - pub r#event_type: Option, - pub r#start_time: Option, - pub r#start_position_lat: Option, - pub r#start_position_long: Option, - pub r#end_position_lat: Option, - pub r#end_position_long: Option, - pub r#total_elapsed_time: Option, - pub r#total_timer_time: Option, - pub r#total_distance: Option, - pub r#total_cycles: Option, - pub r#total_calories: Option, - pub r#total_fat_calories: Option, - pub r#avg_speed: Option, - pub r#max_speed: Option, - pub r#avg_heart_rate: Option, - pub r#max_heart_rate: Option, - pub r#avg_cadence: Option, - pub r#max_cadence: Option, - pub r#avg_power: Option, - pub r#max_power: Option, - pub r#total_ascent: Option, - pub r#total_descent: Option, - pub r#sport: Option, - pub r#event_group: Option, - pub r#nec_lat: Option, - pub r#nec_long: Option, - pub r#swc_lat: Option, - pub r#swc_long: Option, - pub r#name: Option, - pub r#normalized_power: Option, - pub r#left_right_balance: Option, - pub r#sub_sport: Option, - pub r#total_work: Option, - pub r#avg_altitude: Option, - pub r#max_altitude: Option, - pub r#gps_accuracy: Option, - pub r#avg_grade: Option, - pub r#avg_pos_grade: Option, - pub r#avg_neg_grade: Option, - pub r#max_pos_grade: Option, - pub r#max_neg_grade: Option, - pub r#avg_temperature: Option, - pub r#max_temperature: Option, - pub r#total_moving_time: Option, - pub r#avg_pos_vertical_speed: Option, - pub r#avg_neg_vertical_speed: Option, - pub r#max_pos_vertical_speed: Option, - pub r#max_neg_vertical_speed: Option, - pub r#time_in_hr_zone: Option, - pub r#time_in_speed_zone: Option, - pub r#time_in_cadence_zone: Option, - pub r#time_in_power_zone: Option, - pub r#repetition_num: Option, - pub r#min_altitude: Option, - pub r#min_heart_rate: Option, - pub r#active_time: Option, - pub r#wkt_step_index: Option, - pub r#sport_event: Option, - pub r#avg_left_torque_effectiveness: Option, - pub r#avg_right_torque_effectiveness: Option, - pub r#avg_left_pedal_smoothness: Option, - pub r#avg_right_pedal_smoothness: Option, - pub r#avg_combined_pedal_smoothness: Option, - pub r#status: Option, - pub r#uuid: Option, - pub r#avg_fractional_cadence: Option, - pub r#max_fractional_cadence: Option, - pub r#total_fractional_cycles: Option, - pub r#front_gear_shift_count: Option, - pub r#rear_gear_shift_count: Option, - pub r#time_standing: Option, - pub r#stand_count: Option, - pub r#avg_left_pco: Option, - pub r#avg_right_pco: Option, - pub r#avg_left_power_phase: Option, - pub r#avg_left_power_phase_peak: Option, - pub r#avg_right_power_phase: Option, - pub r#avg_right_power_phase_peak: Option, - pub r#avg_power_position: Option, - pub r#max_power_position: Option, - pub r#avg_cadence_position: Option, - pub r#max_cadence_position: Option, - pub r#manufacturer: Option, - pub r#total_grit: Option, - pub r#total_flow: Option, - pub r#avg_grit: Option, - pub r#avg_flow: Option, - pub r#total_fractional_ascent: Option, - pub r#total_fractional_descent: Option, - pub r#enhanced_avg_altitude: Option, - pub r#enhanced_max_altitude: Option, - pub r#enhanced_min_altitude: Option, - pub r#timestamp: Option, - pub r#message_index: Option, -} -impl FitMessage for SegmentLap { - const NAME: &'static str = "SegmentLap"; - const KIND: MesgNum = MesgNum::SegmentLap; - fn parse_with_options( - record: FitDataRecord, - options: MessageParseOptions, - ) -> Result { - if record.kind() != Self::KIND { - return Err(TryFromRecordError::unexpected_message_kind::(&record)); - } - let mut r#event = None; - let mut r#event_type = None; - let mut r#start_time = None; - let mut r#start_position_lat = None; - let mut r#start_position_long = None; - let mut r#end_position_lat = None; - let mut r#end_position_long = None; - let mut r#total_elapsed_time = None; - let mut r#total_timer_time = None; - let mut r#total_distance = None; - let mut r#total_cycles = None; - let mut r#total_calories = None; - let mut r#total_fat_calories = None; - let mut r#avg_speed = None; - let mut r#max_speed = None; - let mut r#avg_heart_rate = None; - let mut r#max_heart_rate = None; - let mut r#avg_cadence = None; - let mut r#max_cadence = None; - let mut r#avg_power = None; - let mut r#max_power = None; - let mut r#total_ascent = None; - let mut r#total_descent = None; - let mut r#sport = None; - let mut r#event_group = None; - let mut r#nec_lat = None; - let mut r#nec_long = None; - let mut r#swc_lat = None; - let mut r#swc_long = None; - let mut r#name = None; - let mut r#normalized_power = None; - let mut r#left_right_balance = None; - let mut r#sub_sport = None; - let mut r#total_work = None; - let mut r#avg_altitude = None; - let mut r#max_altitude = None; - let mut r#gps_accuracy = None; - let mut r#avg_grade = None; - let mut r#avg_pos_grade = None; - let mut r#avg_neg_grade = None; - let mut r#max_pos_grade = None; - let mut r#max_neg_grade = None; - let mut r#avg_temperature = None; - let mut r#max_temperature = None; - let mut r#total_moving_time = None; - let mut r#avg_pos_vertical_speed = None; - let mut r#avg_neg_vertical_speed = None; - let mut r#max_pos_vertical_speed = None; - let mut r#max_neg_vertical_speed = None; - let mut r#time_in_hr_zone = None; - let mut r#time_in_speed_zone = None; - let mut r#time_in_cadence_zone = None; - let mut r#time_in_power_zone = None; - let mut r#repetition_num = None; - let mut r#min_altitude = None; - let mut r#min_heart_rate = None; - let mut r#active_time = None; - let mut r#wkt_step_index = None; - let mut r#sport_event = None; - let mut r#avg_left_torque_effectiveness = None; - let mut r#avg_right_torque_effectiveness = None; - let mut r#avg_left_pedal_smoothness = None; - let mut r#avg_right_pedal_smoothness = None; - let mut r#avg_combined_pedal_smoothness = None; - let mut r#status = None; - let mut r#uuid = None; - let mut r#avg_fractional_cadence = None; - let mut r#max_fractional_cadence = None; - let mut r#total_fractional_cycles = None; - let mut r#front_gear_shift_count = None; - let mut r#rear_gear_shift_count = None; - let mut r#time_standing = None; - let mut r#stand_count = None; - let mut r#avg_left_pco = None; - let mut r#avg_right_pco = None; - let mut r#avg_left_power_phase = None; - let mut r#avg_left_power_phase_peak = None; - let mut r#avg_right_power_phase = None; - let mut r#avg_right_power_phase_peak = None; - let mut r#avg_power_position = None; - let mut r#max_power_position = None; - let mut r#avg_cadence_position = None; - let mut r#max_cadence_position = None; - let mut r#manufacturer = None; - let mut r#total_grit = None; - let mut r#total_flow = None; - let mut r#avg_grit = None; - let mut r#avg_flow = None; - let mut r#total_fractional_ascent = None; - let mut r#total_fractional_descent = None; - let mut r#enhanced_avg_altitude = None; - let mut r#enhanced_max_altitude = None; - let mut r#enhanced_min_altitude = None; - let mut r#timestamp = None; - let mut r#message_index = None; - for field in record.into_vec() { - match field.number() { - 0u8 => { - r#event = Some(field.into_value()); - } - 1u8 => { - r#event_type = Some(field.into_value()); - } - 2u8 => { - r#start_time = Some(field.into_value()); - } - 3u8 => { - r#start_position_lat = Some(field.into_value()); - } - 4u8 => { - r#start_position_long = Some(field.into_value()); - } - 5u8 => { - r#end_position_lat = Some(field.into_value()); - } - 6u8 => { - r#end_position_long = Some(field.into_value()); - } - 7u8 => { - r#total_elapsed_time = Some(field.into_value()); - } - 8u8 => { - r#total_timer_time = Some(field.into_value()); - } - 9u8 => { - r#total_distance = Some(field.into_value()); - } - 10u8 => { - r#total_cycles = Some(field.into_value()); - } - 11u8 => { - r#total_calories = Some(field.into_value()); - } - 12u8 => { - r#total_fat_calories = Some(field.into_value()); - } - 13u8 => { - r#avg_speed = Some(field.into_value()); - } - 14u8 => { - r#max_speed = Some(field.into_value()); - } - 15u8 => { - r#avg_heart_rate = Some(field.into_value()); - } - 16u8 => { - r#max_heart_rate = Some(field.into_value()); - } - 17u8 => { - r#avg_cadence = Some(field.into_value()); - } - 18u8 => { - r#max_cadence = Some(field.into_value()); - } - 19u8 => { - r#avg_power = Some(field.into_value()); - } - 20u8 => { - r#max_power = Some(field.into_value()); - } - 21u8 => { - r#total_ascent = Some(field.into_value()); - } - 22u8 => { - r#total_descent = Some(field.into_value()); - } - 23u8 => { - r#sport = Some(field.into_value()); - } - 24u8 => { - r#event_group = Some(field.into_value()); - } - 25u8 => { - r#nec_lat = Some(field.into_value()); - } - 26u8 => { - r#nec_long = Some(field.into_value()); - } - 27u8 => { - r#swc_lat = Some(field.into_value()); - } - 28u8 => { - r#swc_long = Some(field.into_value()); - } - 29u8 => { - r#name = Some(field.into_value()); - } - 30u8 => { - r#normalized_power = Some(field.into_value()); - } - 31u8 => { - r#left_right_balance = Some(field.into_value()); - } - 32u8 => { - r#sub_sport = Some(field.into_value()); - } - 33u8 => { - r#total_work = Some(field.into_value()); - } - 34u8 => { - r#avg_altitude = Some(field.into_value()); - } - 35u8 => { - r#max_altitude = Some(field.into_value()); - } - 36u8 => { - r#gps_accuracy = Some(field.into_value()); - } - 37u8 => { - r#avg_grade = Some(field.into_value()); - } - 38u8 => { - r#avg_pos_grade = Some(field.into_value()); - } - 39u8 => { - r#avg_neg_grade = Some(field.into_value()); - } - 40u8 => { - r#max_pos_grade = Some(field.into_value()); - } - 41u8 => { - r#max_neg_grade = Some(field.into_value()); - } - 42u8 => { - r#avg_temperature = Some(field.into_value()); - } - 43u8 => { - r#max_temperature = Some(field.into_value()); - } - 44u8 => { - r#total_moving_time = Some(field.into_value()); - } - 45u8 => { - r#avg_pos_vertical_speed = Some(field.into_value()); - } - 46u8 => { - r#avg_neg_vertical_speed = Some(field.into_value()); - } - 47u8 => { - r#max_pos_vertical_speed = Some(field.into_value()); - } - 48u8 => { - r#max_neg_vertical_speed = Some(field.into_value()); - } - 49u8 => { - r#time_in_hr_zone = Some(field.into_value()); - } - 50u8 => { - r#time_in_speed_zone = Some(field.into_value()); - } - 51u8 => { - r#time_in_cadence_zone = Some(field.into_value()); - } - 52u8 => { - r#time_in_power_zone = Some(field.into_value()); - } - 53u8 => { - r#repetition_num = Some(field.into_value()); - } - 54u8 => { - r#min_altitude = Some(field.into_value()); - } - 55u8 => { - r#min_heart_rate = Some(field.into_value()); - } - 56u8 => { - r#active_time = Some(field.into_value()); - } - 57u8 => { - r#wkt_step_index = Some(field.into_value()); - } - 58u8 => { - r#sport_event = Some(field.into_value()); - } - 59u8 => { - r#avg_left_torque_effectiveness = Some(field.into_value()); - } - 60u8 => { - r#avg_right_torque_effectiveness = Some(field.into_value()); - } - 61u8 => { - r#avg_left_pedal_smoothness = Some(field.into_value()); - } - 62u8 => { - r#avg_right_pedal_smoothness = Some(field.into_value()); - } - 63u8 => { - r#avg_combined_pedal_smoothness = Some(field.into_value()); - } - 64u8 => { - r#status = Some(field.into_value()); - } - 65u8 => { - r#uuid = Some(field.into_value()); - } - 66u8 => { - r#avg_fractional_cadence = Some(field.into_value()); - } - 67u8 => { - r#max_fractional_cadence = Some(field.into_value()); - } - 68u8 => { - r#total_fractional_cycles = Some(field.into_value()); - } - 69u8 => { - r#front_gear_shift_count = Some(field.into_value()); - } - 70u8 => { - r#rear_gear_shift_count = Some(field.into_value()); - } - 71u8 => { - r#time_standing = Some(field.into_value()); - } - 72u8 => { - r#stand_count = Some(field.into_value()); - } - 73u8 => { - r#avg_left_pco = Some(field.into_value()); - } - 74u8 => { - r#avg_right_pco = Some(field.into_value()); - } - 75u8 => { - r#avg_left_power_phase = Some(field.into_value()); - } - 76u8 => { - r#avg_left_power_phase_peak = Some(field.into_value()); - } - 77u8 => { - r#avg_right_power_phase = Some(field.into_value()); - } - 78u8 => { - r#avg_right_power_phase_peak = Some(field.into_value()); - } - 79u8 => { - r#avg_power_position = Some(field.into_value()); - } - 80u8 => { - r#max_power_position = Some(field.into_value()); - } - 81u8 => { - r#avg_cadence_position = Some(field.into_value()); - } - 82u8 => { - r#max_cadence_position = Some(field.into_value()); - } - 83u8 => { - r#manufacturer = Some(field.into_value()); - } - 84u8 => { - r#total_grit = Some(field.into_value()); - } - 85u8 => { - r#total_flow = Some(field.into_value()); - } - 86u8 => { - r#avg_grit = Some(field.into_value()); - } - 87u8 => { - r#avg_flow = Some(field.into_value()); - } - 89u8 => { - r#total_fractional_ascent = Some(field.into_value()); - } - 90u8 => { - r#total_fractional_descent = Some(field.into_value()); - } - 91u8 => { - r#enhanced_avg_altitude = Some(field.into_value()); - } - 92u8 => { - r#enhanced_max_altitude = Some(field.into_value()); - } - 93u8 => { - r#enhanced_min_altitude = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + Err(value) => { + invalid_fields.insert("avg_flow", value); + } + }, + 89u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_fractional_ascent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_fractional_ascent", value); + } + }, + 90u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#total_fractional_descent = Some(_value); + } + Err(value) => { + invalid_fields.insert("total_fractional_descent", value); + } + }, + 91u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_avg_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_avg_altitude", value); + } + }, + 92u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_max_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_max_altitude", value); + } + }, + 93u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enhanced_min_altitude = Some(_value); + } + Err(value) => { + invalid_fields.insert("enhanced_min_altitude", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -8979,8 +14856,12 @@ impl FitMessage for SegmentLap { r#enhanced_min_altitude, r#timestamp, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for SegmentLap { type Error = TryFromRecordError; @@ -8991,15 +14872,16 @@ impl TryFrom for SegmentLap { #[doc = "Summary of the unique segment and leaderboard information associated with a segment file. This message is used to compile a segment list file describing all segment files on a device. The segment list file is used when refreshing the contents of a segment file with the latest available leaderboard information."] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct SegmentFile { - pub r#file_uuid: Option, - pub r#enabled: Option, - pub r#user_profile_primary_key: Option, - pub r#leader_type: Option, - pub r#leader_group_primary_key: Option, - pub r#leader_activity_id: Option, - pub r#leader_activity_id_string: Option, - pub r#default_race_leader: Option, - pub r#message_index: Option, + pub r#file_uuid: Option, + pub r#enabled: Option, + pub r#user_profile_primary_key: Option, + pub r#leader_type: Option, + pub r#leader_group_primary_key: Option, + pub r#leader_activity_id: Option, + pub r#leader_activity_id_string: Option, + pub r#default_race_leader: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for SegmentFile { const NAME: &'static str = "SegmentFile"; @@ -9020,35 +14902,82 @@ impl FitMessage for SegmentFile { let mut r#leader_activity_id_string = None; let mut r#default_race_leader = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 1u8 => { - r#file_uuid = Some(field.into_value()); - } - 3u8 => { - r#enabled = Some(field.into_value()); - } - 4u8 => { - r#user_profile_primary_key = Some(field.into_value()); - } - 7u8 => { - r#leader_type = Some(field.into_value()); - } - 8u8 => { - r#leader_group_primary_key = Some(field.into_value()); - } - 9u8 => { - r#leader_activity_id = Some(field.into_value()); - } - 10u8 => { - r#leader_activity_id_string = Some(field.into_value()); - } - 11u8 => { - r#default_race_leader = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#file_uuid = Some(_value); + } + Err(value) => { + invalid_fields.insert("file_uuid", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("enabled", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#user_profile_primary_key = Some(_value); + } + Err(value) => { + invalid_fields.insert("user_profile_primary_key", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#leader_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("leader_type", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#leader_group_primary_key = Some(_value); + } + Err(value) => { + invalid_fields.insert("leader_group_primary_key", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#leader_activity_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("leader_activity_id", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#leader_activity_id_string = Some(_value); + } + Err(value) => { + invalid_fields.insert("leader_activity_id_string", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#default_race_leader = Some(_value); + } + Err(value) => { + invalid_fields.insert("default_race_leader", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -9066,8 +14995,12 @@ impl FitMessage for SegmentFile { r#leader_activity_id_string, r#default_race_leader, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for SegmentFile { type Error = TryFromRecordError; @@ -9077,14 +15010,15 @@ impl TryFrom for SegmentFile { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Workout { - pub r#sport: Option, - pub r#capabilities: Option, - pub r#num_valid_steps: Option, - pub r#wkt_name: Option, - pub r#sub_sport: Option, - pub r#pool_length: Option, - pub r#pool_length_unit: Option, - pub r#message_index: Option, + pub r#sport: Option, + pub r#capabilities: Option, + pub r#num_valid_steps: Option, + pub r#wkt_name: Option, + pub r#sub_sport: Option, + pub r#pool_length: Option, + pub r#pool_length_unit: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Workout { const NAME: &'static str = "Workout"; @@ -9104,32 +15038,74 @@ impl FitMessage for Workout { let mut r#pool_length = None; let mut r#pool_length_unit = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 4u8 => { - r#sport = Some(field.into_value()); - } - 5u8 => { - r#capabilities = Some(field.into_value()); - } - 6u8 => { - r#num_valid_steps = Some(field.into_value()); - } - 8u8 => { - r#wkt_name = Some(field.into_value()); - } - 11u8 => { - r#sub_sport = Some(field.into_value()); - } - 14u8 => { - r#pool_length = Some(field.into_value()); - } - 15u8 => { - r#pool_length_unit = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#capabilities = Some(_value); + } + Err(value) => { + invalid_fields.insert("capabilities", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#num_valid_steps = Some(_value); + } + Err(value) => { + invalid_fields.insert("num_valid_steps", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#wkt_name = Some(_value); + } + Err(value) => { + invalid_fields.insert("wkt_name", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sub_sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sub_sport", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pool_length = Some(_value); + } + Err(value) => { + invalid_fields.insert("pool_length", value); + } + }, + 15u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pool_length_unit = Some(_value); + } + Err(value) => { + invalid_fields.insert("pool_length_unit", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -9146,8 +15122,12 @@ impl FitMessage for Workout { r#pool_length, r#pool_length_unit, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Workout { type Error = TryFromRecordError; @@ -9157,13 +15137,14 @@ impl TryFrom for Workout { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct WorkoutSession { - pub r#sport: Option, - pub r#sub_sport: Option, - pub r#num_valid_steps: Option, - pub r#first_step_index: Option, - pub r#pool_length: Option, - pub r#pool_length_unit: Option, - pub r#message_index: Option, + pub r#sport: Option, + pub r#sub_sport: Option, + pub r#num_valid_steps: Option, + pub r#first_step_index: Option, + pub r#pool_length: Option, + pub r#pool_length_unit: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for WorkoutSession { const NAME: &'static str = "WorkoutSession"; @@ -9182,29 +15163,66 @@ impl FitMessage for WorkoutSession { let mut r#pool_length = None; let mut r#pool_length_unit = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#sport = Some(field.into_value()); - } - 1u8 => { - r#sub_sport = Some(field.into_value()); - } - 2u8 => { - r#num_valid_steps = Some(field.into_value()); - } - 3u8 => { - r#first_step_index = Some(field.into_value()); - } - 4u8 => { - r#pool_length = Some(field.into_value()); - } - 5u8 => { - r#pool_length_unit = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sub_sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sub_sport", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#num_valid_steps = Some(_value); + } + Err(value) => { + invalid_fields.insert("num_valid_steps", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#first_step_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("first_step_index", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pool_length = Some(_value); + } + Err(value) => { + invalid_fields.insert("pool_length", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pool_length_unit = Some(_value); + } + Err(value) => { + invalid_fields.insert("pool_length_unit", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -9220,8 +15238,12 @@ impl FitMessage for WorkoutSession { r#pool_length, r#pool_length_unit, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for WorkoutSession { type Error = TryFromRecordError; @@ -9231,25 +15253,26 @@ impl TryFrom for WorkoutSession { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct WorkoutStep { - pub r#wkt_step_name: Option, - pub r#duration_type: Option, - pub r#duration_value: Option, - pub r#target_type: Option, - pub r#target_value: Option, - pub r#custom_target_value_low: Option, - pub r#custom_target_value_high: Option, - pub r#intensity: Option, - pub r#notes: Option, - pub r#equipment: Option, - pub r#exercise_category: Option, - pub r#exercise_name: Option, - pub r#exercise_weight: Option, - pub r#weight_display_unit: Option, - pub r#secondary_target_type: Option, - pub r#secondary_target_value: Option, - pub r#secondary_custom_target_value_low: Option, - pub r#secondary_custom_target_value_high: Option, - pub r#message_index: Option, + pub r#wkt_step_name: Option, + pub r#duration_type: Option, + pub r#duration_value: Option, + pub r#target_type: Option, + pub r#target_value: Option, + pub r#custom_target_value_low: Option, + pub r#custom_target_value_high: Option, + pub r#intensity: Option, + pub r#notes: Option, + pub r#equipment: Option, + pub r#exercise_category: Option, + pub r#exercise_name: Option, + pub r#exercise_weight: Option, + pub r#weight_display_unit: Option, + pub r#secondary_target_type: Option, + pub r#secondary_target_value: Option, + pub r#secondary_custom_target_value_low: Option, + pub r#secondary_custom_target_value_high: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for WorkoutStep { const NAME: &'static str = "WorkoutStep"; @@ -9280,65 +15303,162 @@ impl FitMessage for WorkoutStep { let mut r#secondary_custom_target_value_low = None; let mut r#secondary_custom_target_value_high = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#wkt_step_name = Some(field.into_value()); - } - 1u8 => { - r#duration_type = Some(field.into_value()); - } - 2u8 => { - r#duration_value = Some(field.into_value()); - } - 3u8 => { - r#target_type = Some(field.into_value()); - } - 4u8 => { - r#target_value = Some(field.into_value()); - } - 5u8 => { - r#custom_target_value_low = Some(field.into_value()); - } - 6u8 => { - r#custom_target_value_high = Some(field.into_value()); - } - 7u8 => { - r#intensity = Some(field.into_value()); - } - 8u8 => { - r#notes = Some(field.into_value()); - } - 9u8 => { - r#equipment = Some(field.into_value()); - } - 10u8 => { - r#exercise_category = Some(field.into_value()); - } - 11u8 => { - r#exercise_name = Some(field.into_value()); - } - 12u8 => { - r#exercise_weight = Some(field.into_value()); - } - 13u8 => { - r#weight_display_unit = Some(field.into_value()); - } - 19u8 => { - r#secondary_target_type = Some(field.into_value()); - } - 20u8 => { - r#secondary_target_value = Some(field.into_value()); - } - 21u8 => { - r#secondary_custom_target_value_low = Some(field.into_value()); - } - 22u8 => { - r#secondary_custom_target_value_high = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#wkt_step_name = Some(_value); + } + Err(value) => { + invalid_fields.insert("wkt_step_name", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#duration_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("duration_type", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#duration_value = Some(_value); + } + Err(value) => { + invalid_fields.insert("duration_value", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#target_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("target_type", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#target_value = Some(_value); + } + Err(value) => { + invalid_fields.insert("target_value", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#custom_target_value_low = Some(_value); + } + Err(value) => { + invalid_fields.insert("custom_target_value_low", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#custom_target_value_high = Some(_value); + } + Err(value) => { + invalid_fields.insert("custom_target_value_high", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#intensity = Some(_value); + } + Err(value) => { + invalid_fields.insert("intensity", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#notes = Some(_value); + } + Err(value) => { + invalid_fields.insert("notes", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#equipment = Some(_value); + } + Err(value) => { + invalid_fields.insert("equipment", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#exercise_category = Some(_value); + } + Err(value) => { + invalid_fields.insert("exercise_category", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#exercise_name = Some(_value); + } + Err(value) => { + invalid_fields.insert("exercise_name", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#exercise_weight = Some(_value); + } + Err(value) => { + invalid_fields.insert("exercise_weight", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#weight_display_unit = Some(_value); + } + Err(value) => { + invalid_fields.insert("weight_display_unit", value); + } + }, + 19u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#secondary_target_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("secondary_target_type", value); + } + }, + 20u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#secondary_target_value = Some(_value); + } + Err(value) => { + invalid_fields.insert("secondary_target_value", value); + } + }, + 21u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#secondary_custom_target_value_low = Some(_value); + } + Err(value) => { + invalid_fields.insert("secondary_custom_target_value_low", value); + } + }, + 22u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#secondary_custom_target_value_high = Some(_value); + } + Err(value) => { + invalid_fields.insert("secondary_custom_target_value_high", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -9366,8 +15486,12 @@ impl FitMessage for WorkoutStep { r#secondary_custom_target_value_low, r#secondary_custom_target_value_high, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for WorkoutStep { type Error = TryFromRecordError; @@ -9377,10 +15501,11 @@ impl TryFrom for WorkoutStep { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct ExerciseTitle { - pub r#exercise_category: Option, - pub r#exercise_name: Option, - pub r#wkt_step_name: Option, - pub r#message_index: Option, + pub r#exercise_category: Option, + pub r#exercise_name: Option, + pub r#wkt_step_name: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for ExerciseTitle { const NAME: &'static str = "ExerciseTitle"; @@ -9396,20 +15521,42 @@ impl FitMessage for ExerciseTitle { let mut r#exercise_name = None; let mut r#wkt_step_name = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#exercise_category = Some(field.into_value()); - } - 1u8 => { - r#exercise_name = Some(field.into_value()); - } - 2u8 => { - r#wkt_step_name = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#exercise_category = Some(_value); + } + Err(value) => { + invalid_fields.insert("exercise_category", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#exercise_name = Some(_value); + } + Err(value) => { + invalid_fields.insert("exercise_name", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#wkt_step_name = Some(_value); + } + Err(value) => { + invalid_fields.insert("wkt_step_name", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -9422,8 +15569,12 @@ impl FitMessage for ExerciseTitle { r#exercise_name, r#wkt_step_name, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for ExerciseTitle { type Error = TryFromRecordError; @@ -9433,13 +15584,14 @@ impl TryFrom for ExerciseTitle { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Schedule { - pub r#manufacturer: Option, - pub r#product: Option, - pub r#serial_number: Option, - pub r#time_created: Option, - pub r#completed: Option, - pub r#type: Option, - pub r#scheduled_time: Option, + pub r#manufacturer: Option, + pub r#product: Option, + pub r#serial_number: Option, + pub r#time_created: Option, + pub r#completed: Option, + pub r#type: Option, + pub r#scheduled_time: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Schedule { const NAME: &'static str = "Schedule"; @@ -9458,29 +15610,66 @@ impl FitMessage for Schedule { let mut r#completed = None; let mut r#type = None; let mut r#scheduled_time = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#manufacturer = Some(field.into_value()); - } - 1u8 => { - r#product = Some(field.into_value()); - } - 2u8 => { - r#serial_number = Some(field.into_value()); - } - 3u8 => { - r#time_created = Some(field.into_value()); - } - 4u8 => { - r#completed = Some(field.into_value()); - } - 5u8 => { - r#type = Some(field.into_value()); - } - 6u8 => { - r#scheduled_time = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#manufacturer = Some(_value); + } + Err(value) => { + invalid_fields.insert("manufacturer", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#product = Some(_value); + } + Err(value) => { + invalid_fields.insert("product", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#serial_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("serial_number", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_created = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_created", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#completed = Some(_value); + } + Err(value) => { + invalid_fields.insert("completed", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#type = Some(_value); + } + Err(value) => { + invalid_fields.insert("type", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#scheduled_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("scheduled_time", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -9496,8 +15685,12 @@ impl FitMessage for Schedule { r#completed, r#type, r#scheduled_time, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Schedule { type Error = TryFromRecordError; @@ -9507,16 +15700,17 @@ impl TryFrom for Schedule { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Totals { - pub r#timer_time: Option, - pub r#distance: Option, - pub r#calories: Option, - pub r#sport: Option, - pub r#elapsed_time: Option, - pub r#sessions: Option, - pub r#active_time: Option, - pub r#sport_index: Option, - pub r#timestamp: Option, - pub r#message_index: Option, + pub r#timer_time: Option, + pub r#distance: Option, + pub r#calories: Option, + pub r#sport: Option, + pub r#elapsed_time: Option, + pub r#sessions: Option, + pub r#active_time: Option, + pub r#sport_index: Option, + pub r#timestamp: Option, + pub r#message_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Totals { const NAME: &'static str = "Totals"; @@ -9538,38 +15732,90 @@ impl FitMessage for Totals { let mut r#sport_index = None; let mut r#timestamp = None; let mut r#message_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timer_time = Some(field.into_value()); - } - 1u8 => { - r#distance = Some(field.into_value()); - } - 2u8 => { - r#calories = Some(field.into_value()); - } - 3u8 => { - r#sport = Some(field.into_value()); - } - 4u8 => { - r#elapsed_time = Some(field.into_value()); - } - 5u8 => { - r#sessions = Some(field.into_value()); - } - 6u8 => { - r#active_time = Some(field.into_value()); - } - 9u8 => { - r#sport_index = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } - 254u8 => { - r#message_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timer_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("timer_time", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("distance", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("calories", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#elapsed_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("elapsed_time", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sessions = Some(_value); + } + Err(value) => { + invalid_fields.insert("sessions", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#active_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("active_time", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport_index", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, + 254u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#message_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("message_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -9588,8 +15834,12 @@ impl FitMessage for Totals { r#sport_index, r#timestamp, r#message_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Totals { type Error = TryFromRecordError; @@ -9599,20 +15849,21 @@ impl TryFrom for Totals { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct WeightScale { - pub r#weight: Option, - pub r#percent_fat: Option, - pub r#percent_hydration: Option, - pub r#visceral_fat_mass: Option, - pub r#bone_mass: Option, - pub r#muscle_mass: Option, - pub r#basal_met: Option, - pub r#physique_rating: Option, - pub r#active_met: Option, - pub r#metabolic_age: Option, - pub r#visceral_fat_rating: Option, - pub r#user_profile_index: Option, - pub r#bmi: Option, - pub r#timestamp: Option, + pub r#weight: Option, + pub r#percent_fat: Option, + pub r#percent_hydration: Option, + pub r#visceral_fat_mass: Option, + pub r#bone_mass: Option, + pub r#muscle_mass: Option, + pub r#basal_met: Option, + pub r#physique_rating: Option, + pub r#active_met: Option, + pub r#metabolic_age: Option, + pub r#visceral_fat_rating: Option, + pub r#user_profile_index: Option, + pub r#bmi: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for WeightScale { const NAME: &'static str = "WeightScale"; @@ -9638,50 +15889,122 @@ impl FitMessage for WeightScale { let mut r#user_profile_index = None; let mut r#bmi = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#weight = Some(field.into_value()); - } - 1u8 => { - r#percent_fat = Some(field.into_value()); - } - 2u8 => { - r#percent_hydration = Some(field.into_value()); - } - 3u8 => { - r#visceral_fat_mass = Some(field.into_value()); - } - 4u8 => { - r#bone_mass = Some(field.into_value()); - } - 5u8 => { - r#muscle_mass = Some(field.into_value()); - } - 7u8 => { - r#basal_met = Some(field.into_value()); - } - 8u8 => { - r#physique_rating = Some(field.into_value()); - } - 9u8 => { - r#active_met = Some(field.into_value()); - } - 10u8 => { - r#metabolic_age = Some(field.into_value()); - } - 11u8 => { - r#visceral_fat_rating = Some(field.into_value()); - } - 12u8 => { - r#user_profile_index = Some(field.into_value()); - } - 13u8 => { - r#bmi = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#weight = Some(_value); + } + Err(value) => { + invalid_fields.insert("weight", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#percent_fat = Some(_value); + } + Err(value) => { + invalid_fields.insert("percent_fat", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#percent_hydration = Some(_value); + } + Err(value) => { + invalid_fields.insert("percent_hydration", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#visceral_fat_mass = Some(_value); + } + Err(value) => { + invalid_fields.insert("visceral_fat_mass", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bone_mass = Some(_value); + } + Err(value) => { + invalid_fields.insert("bone_mass", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#muscle_mass = Some(_value); + } + Err(value) => { + invalid_fields.insert("muscle_mass", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#basal_met = Some(_value); + } + Err(value) => { + invalid_fields.insert("basal_met", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#physique_rating = Some(_value); + } + Err(value) => { + invalid_fields.insert("physique_rating", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#active_met = Some(_value); + } + Err(value) => { + invalid_fields.insert("active_met", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#metabolic_age = Some(_value); + } + Err(value) => { + invalid_fields.insert("metabolic_age", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#visceral_fat_rating = Some(_value); + } + Err(value) => { + invalid_fields.insert("visceral_fat_rating", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#user_profile_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("user_profile_index", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bmi = Some(_value); + } + Err(value) => { + invalid_fields.insert("bmi", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -9704,8 +16027,12 @@ impl FitMessage for WeightScale { r#user_profile_index, r#bmi, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for WeightScale { type Error = TryFromRecordError; @@ -9715,17 +16042,18 @@ impl TryFrom for WeightScale { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct BloodPressure { - pub r#systolic_pressure: Option, - pub r#diastolic_pressure: Option, - pub r#mean_arterial_pressure: Option, - pub r#map_3_sample_mean: Option, - pub r#map_morning_values: Option, - pub r#map_evening_values: Option, - pub r#heart_rate: Option, - pub r#heart_rate_type: Option, - pub r#status: Option, - pub r#user_profile_index: Option, - pub r#timestamp: Option, + pub r#systolic_pressure: Option, + pub r#diastolic_pressure: Option, + pub r#mean_arterial_pressure: Option, + pub r#map_3_sample_mean: Option, + pub r#map_morning_values: Option, + pub r#map_evening_values: Option, + pub r#heart_rate: Option, + pub r#heart_rate_type: Option, + pub r#status: Option, + pub r#user_profile_index: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for BloodPressure { const NAME: &'static str = "BloodPressure"; @@ -9748,41 +16076,98 @@ impl FitMessage for BloodPressure { let mut r#status = None; let mut r#user_profile_index = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#systolic_pressure = Some(field.into_value()); - } - 1u8 => { - r#diastolic_pressure = Some(field.into_value()); - } - 2u8 => { - r#mean_arterial_pressure = Some(field.into_value()); - } - 3u8 => { - r#map_3_sample_mean = Some(field.into_value()); - } - 4u8 => { - r#map_morning_values = Some(field.into_value()); - } - 5u8 => { - r#map_evening_values = Some(field.into_value()); - } - 6u8 => { - r#heart_rate = Some(field.into_value()); - } - 7u8 => { - r#heart_rate_type = Some(field.into_value()); - } - 8u8 => { - r#status = Some(field.into_value()); - } - 9u8 => { - r#user_profile_index = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#systolic_pressure = Some(_value); + } + Err(value) => { + invalid_fields.insert("systolic_pressure", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#diastolic_pressure = Some(_value); + } + Err(value) => { + invalid_fields.insert("diastolic_pressure", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mean_arterial_pressure = Some(_value); + } + Err(value) => { + invalid_fields.insert("mean_arterial_pressure", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#map_3_sample_mean = Some(_value); + } + Err(value) => { + invalid_fields.insert("map_3_sample_mean", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#map_morning_values = Some(_value); + } + Err(value) => { + invalid_fields.insert("map_morning_values", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#map_evening_values = Some(_value); + } + Err(value) => { + invalid_fields.insert("map_evening_values", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("heart_rate", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#heart_rate_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("heart_rate_type", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#status = Some(_value); + } + Err(value) => { + invalid_fields.insert("status", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#user_profile_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("user_profile_index", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -9802,8 +16187,12 @@ impl FitMessage for BloodPressure { r#status, r#user_profile_index, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for BloodPressure { type Error = TryFromRecordError; @@ -9813,12 +16202,13 @@ impl TryFrom for BloodPressure { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct MonitoringInfo { - pub r#local_timestamp: Option, - pub r#activity_type: Option, - pub r#cycles_to_distance: Option, - pub r#cycles_to_calories: Option, - pub r#resting_metabolic_rate: Option, - pub r#timestamp: Option, + pub r#local_timestamp: Option, + pub r#activity_type: Option, + pub r#cycles_to_distance: Option, + pub r#cycles_to_calories: Option, + pub r#resting_metabolic_rate: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for MonitoringInfo { const NAME: &'static str = "MonitoringInfo"; @@ -9836,26 +16226,58 @@ impl FitMessage for MonitoringInfo { let mut r#cycles_to_calories = None; let mut r#resting_metabolic_rate = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#local_timestamp = Some(field.into_value()); - } - 1u8 => { - r#activity_type = Some(field.into_value()); - } - 3u8 => { - r#cycles_to_distance = Some(field.into_value()); - } - 4u8 => { - r#cycles_to_calories = Some(field.into_value()); - } - 5u8 => { - r#resting_metabolic_rate = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#local_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("local_timestamp", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#activity_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("activity_type", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cycles_to_distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("cycles_to_distance", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cycles_to_calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("cycles_to_calories", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#resting_metabolic_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("resting_metabolic_rate", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -9870,8 +16292,12 @@ impl FitMessage for MonitoringInfo { r#cycles_to_calories, r#resting_metabolic_rate, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for MonitoringInfo { type Error = TryFromRecordError; @@ -9881,35 +16307,36 @@ impl TryFrom for MonitoringInfo { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Monitoring { - pub r#device_index: Option, - pub r#calories: Option, - pub r#distance: Option, - pub r#cycles: Option, - pub r#active_time: Option, - pub r#activity_type: Option, - pub r#activity_subtype: Option, - pub r#activity_level: Option, - pub r#distance_16: Option, - pub r#cycles_16: Option, - pub r#active_time_16: Option, - pub r#local_timestamp: Option, - pub r#temperature: Option, - pub r#temperature_min: Option, - pub r#temperature_max: Option, - pub r#activity_time: Option, - pub r#active_calories: Option, - pub r#current_activity_type_intensity: Option, - pub r#timestamp_min_8: Option, - pub r#timestamp_16: Option, - pub r#heart_rate: Option, - pub r#intensity: Option, - pub r#duration_min: Option, - pub r#duration: Option, - pub r#ascent: Option, - pub r#descent: Option, - pub r#moderate_activity_minutes: Option, - pub r#vigorous_activity_minutes: Option, - pub r#timestamp: Option, + pub r#device_index: Option, + pub r#calories: Option, + pub r#distance: Option, + pub r#cycles: Option, + pub r#active_time: Option, + pub r#activity_type: Option, + pub r#activity_subtype: Option, + pub r#activity_level: Option, + pub r#distance_16: Option, + pub r#cycles_16: Option, + pub r#active_time_16: Option, + pub r#local_timestamp: Option, + pub r#temperature: Option, + pub r#temperature_min: Option, + pub r#temperature_max: Option, + pub r#activity_time: Option, + pub r#active_calories: Option, + pub r#current_activity_type_intensity: Option, + pub r#timestamp_min_8: Option, + pub r#timestamp_16: Option, + pub r#heart_rate: Option, + pub r#intensity: Option, + pub r#duration_min: Option, + pub r#duration: Option, + pub r#ascent: Option, + pub r#descent: Option, + pub r#moderate_activity_minutes: Option, + pub r#vigorous_activity_minutes: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Monitoring { const NAME: &'static str = "Monitoring"; @@ -9950,95 +16377,242 @@ impl FitMessage for Monitoring { let mut r#moderate_activity_minutes = None; let mut r#vigorous_activity_minutes = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#device_index = Some(field.into_value()); - } - 1u8 => { - r#calories = Some(field.into_value()); - } - 2u8 => { - r#distance = Some(field.into_value()); - } - 3u8 => { - r#cycles = Some(field.into_value()); - } - 4u8 => { - r#active_time = Some(field.into_value()); - } - 5u8 => { - r#activity_type = Some(field.into_value()); - } - 6u8 => { - r#activity_subtype = Some(field.into_value()); - } - 7u8 => { - r#activity_level = Some(field.into_value()); - } - 8u8 => { - r#distance_16 = Some(field.into_value()); - } - 9u8 => { - r#cycles_16 = Some(field.into_value()); - } - 10u8 => { - r#active_time_16 = Some(field.into_value()); - } - 11u8 => { - r#local_timestamp = Some(field.into_value()); - } - 12u8 => { - r#temperature = Some(field.into_value()); - } - 14u8 => { - r#temperature_min = Some(field.into_value()); - } - 15u8 => { - r#temperature_max = Some(field.into_value()); - } - 16u8 => { - r#activity_time = Some(field.into_value()); - } - 19u8 => { - r#active_calories = Some(field.into_value()); - } - 24u8 => { - r#current_activity_type_intensity = Some(field.into_value()); - } - 25u8 => { - r#timestamp_min_8 = Some(field.into_value()); - } - 26u8 => { - r#timestamp_16 = Some(field.into_value()); - } - 27u8 => { - r#heart_rate = Some(field.into_value()); - } - 28u8 => { - r#intensity = Some(field.into_value()); - } - 29u8 => { - r#duration_min = Some(field.into_value()); - } - 30u8 => { - r#duration = Some(field.into_value()); - } - 31u8 => { - r#ascent = Some(field.into_value()); - } - 32u8 => { - r#descent = Some(field.into_value()); - } - 33u8 => { - r#moderate_activity_minutes = Some(field.into_value()); - } - 34u8 => { - r#vigorous_activity_minutes = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#device_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("device_index", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("calories", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#distance = Some(_value); + } + Err(value) => { + invalid_fields.insert("distance", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cycles = Some(_value); + } + Err(value) => { + invalid_fields.insert("cycles", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#active_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("active_time", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#activity_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("activity_type", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#activity_subtype = Some(_value); + } + Err(value) => { + invalid_fields.insert("activity_subtype", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#activity_level = Some(_value); + } + Err(value) => { + invalid_fields.insert("activity_level", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#distance_16 = Some(_value); + } + Err(value) => { + invalid_fields.insert("distance_16", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#cycles_16 = Some(_value); + } + Err(value) => { + invalid_fields.insert("cycles_16", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#active_time_16 = Some(_value); + } + Err(value) => { + invalid_fields.insert("active_time_16", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#local_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("local_timestamp", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#temperature = Some(_value); + } + Err(value) => { + invalid_fields.insert("temperature", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#temperature_min = Some(_value); + } + Err(value) => { + invalid_fields.insert("temperature_min", value); + } + }, + 15u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#temperature_max = Some(_value); + } + Err(value) => { + invalid_fields.insert("temperature_max", value); + } + }, + 16u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#activity_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("activity_time", value); + } + }, + 19u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#active_calories = Some(_value); + } + Err(value) => { + invalid_fields.insert("active_calories", value); + } + }, + 24u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#current_activity_type_intensity = Some(_value); + } + Err(value) => { + invalid_fields.insert("current_activity_type_intensity", value); + } + }, + 25u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_min_8 = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_min_8", value); + } + }, + 26u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_16 = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_16", value); + } + }, + 27u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("heart_rate", value); + } + }, + 28u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#intensity = Some(_value); + } + Err(value) => { + invalid_fields.insert("intensity", value); + } + }, + 29u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#duration_min = Some(_value); + } + Err(value) => { + invalid_fields.insert("duration_min", value); + } + }, + 30u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#duration = Some(_value); + } + Err(value) => { + invalid_fields.insert("duration", value); + } + }, + 31u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ascent = Some(_value); + } + Err(value) => { + invalid_fields.insert("ascent", value); + } + }, + 32u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#descent = Some(_value); + } + Err(value) => { + invalid_fields.insert("descent", value); + } + }, + 33u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#moderate_activity_minutes = Some(_value); + } + Err(value) => { + invalid_fields.insert("moderate_activity_minutes", value); + } + }, + 34u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#vigorous_activity_minutes = Some(_value); + } + Err(value) => { + invalid_fields.insert("vigorous_activity_minutes", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10076,8 +16650,12 @@ impl FitMessage for Monitoring { r#moderate_activity_minutes, r#vigorous_activity_minutes, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Monitoring { type Error = TryFromRecordError; @@ -10087,9 +16665,10 @@ impl TryFrom for Monitoring { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct MonitoringHrData { - pub r#resting_heart_rate: Option, - pub r#current_day_resting_heart_rate: Option, - pub r#timestamp: Option, + pub r#resting_heart_rate: Option, + pub r#current_day_resting_heart_rate: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for MonitoringHrData { const NAME: &'static str = "MonitoringHrData"; @@ -10104,17 +16683,34 @@ impl FitMessage for MonitoringHrData { let mut r#resting_heart_rate = None; let mut r#current_day_resting_heart_rate = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#resting_heart_rate = Some(field.into_value()); - } - 1u8 => { - r#current_day_resting_heart_rate = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#resting_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("resting_heart_rate", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#current_day_resting_heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("current_day_resting_heart_rate", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10126,8 +16722,12 @@ impl FitMessage for MonitoringHrData { r#resting_heart_rate, r#current_day_resting_heart_rate, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for MonitoringHrData { type Error = TryFromRecordError; @@ -10137,10 +16737,11 @@ impl TryFrom for MonitoringHrData { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Spo2Data { - pub r#reading_spo2: Option, - pub r#reading_confidence: Option, - pub r#mode: Option, - pub r#timestamp: Option, + pub r#reading_spo2: Option, + pub r#reading_confidence: Option, + pub r#mode: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Spo2Data { const NAME: &'static str = "Spo2Data"; @@ -10156,20 +16757,42 @@ impl FitMessage for Spo2Data { let mut r#reading_confidence = None; let mut r#mode = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#reading_spo2 = Some(field.into_value()); - } - 1u8 => { - r#reading_confidence = Some(field.into_value()); - } - 2u8 => { - r#mode = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#reading_spo2 = Some(_value); + } + Err(value) => { + invalid_fields.insert("reading_spo2", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#reading_confidence = Some(_value); + } + Err(value) => { + invalid_fields.insert("reading_confidence", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mode = Some(_value); + } + Err(value) => { + invalid_fields.insert("mode", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10182,8 +16805,12 @@ impl FitMessage for Spo2Data { r#reading_confidence, r#mode, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Spo2Data { type Error = TryFromRecordError; @@ -10193,12 +16820,13 @@ impl TryFrom for Spo2Data { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Hr { - pub r#fractional_timestamp: Option, - pub r#time256: Option, - pub r#filtered_bpm: Option, - pub r#event_timestamp: Option, - pub r#event_timestamp_12: Option, - pub r#timestamp: Option, + pub r#fractional_timestamp: Option, + pub r#time256: Option, + pub r#filtered_bpm: Option, + pub r#event_timestamp: Option, + pub r#event_timestamp_12: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Hr { const NAME: &'static str = "Hr"; @@ -10216,26 +16844,58 @@ impl FitMessage for Hr { let mut r#event_timestamp = None; let mut r#event_timestamp_12 = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#fractional_timestamp = Some(field.into_value()); - } - 1u8 => { - r#time256 = Some(field.into_value()); - } - 6u8 => { - r#filtered_bpm = Some(field.into_value()); - } - 9u8 => { - r#event_timestamp = Some(field.into_value()); - } - 10u8 => { - r#event_timestamp_12 = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#fractional_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("fractional_timestamp", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time256 = Some(_value); + } + Err(value) => { + invalid_fields.insert("time256", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#filtered_bpm = Some(_value); + } + Err(value) => { + invalid_fields.insert("filtered_bpm", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_timestamp", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_timestamp_12 = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_timestamp_12", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10250,8 +16910,12 @@ impl FitMessage for Hr { r#event_timestamp, r#event_timestamp_12, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for Hr { type Error = TryFromRecordError; @@ -10262,8 +16926,9 @@ impl TryFrom for Hr { #[doc = "Value from 1 to 100 calculated by FirstBeat"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct StressLevel { - pub r#stress_level_value: Option, - pub r#stress_level_time: Option, + pub r#stress_level_value: Option, + pub r#stress_level_time: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for StressLevel { const NAME: &'static str = "StressLevel"; @@ -10277,14 +16942,26 @@ impl FitMessage for StressLevel { } let mut r#stress_level_value = None; let mut r#stress_level_time = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#stress_level_value = Some(field.into_value()); - } - 1u8 => { - r#stress_level_time = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stress_level_value = Some(_value); + } + Err(value) => { + invalid_fields.insert("stress_level_value", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stress_level_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("stress_level_time", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10295,8 +16972,12 @@ impl FitMessage for StressLevel { Ok(Self { r#stress_level_value, r#stress_level_time, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for StressLevel { type Error = TryFromRecordError; @@ -10306,14 +16987,15 @@ impl TryFrom for StressLevel { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct MaxMetData { - pub r#update_time: Option, - pub r#vo2_max: Option, - pub r#sport: Option, - pub r#sub_sport: Option, - pub r#max_met_category: Option, - pub r#calibrated_data: Option, - pub r#hr_source: Option, - pub r#speed_source: Option, + pub r#update_time: Option, + pub r#vo2_max: Option, + pub r#sport: Option, + pub r#sub_sport: Option, + pub r#max_met_category: Option, + pub r#calibrated_data: Option, + pub r#hr_source: Option, + pub r#speed_source: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for MaxMetData { const NAME: &'static str = "MaxMetData"; @@ -10333,32 +17015,74 @@ impl FitMessage for MaxMetData { let mut r#calibrated_data = None; let mut r#hr_source = None; let mut r#speed_source = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#update_time = Some(field.into_value()); - } - 2u8 => { - r#vo2_max = Some(field.into_value()); - } - 5u8 => { - r#sport = Some(field.into_value()); - } - 6u8 => { - r#sub_sport = Some(field.into_value()); - } - 8u8 => { - r#max_met_category = Some(field.into_value()); - } - 9u8 => { - r#calibrated_data = Some(field.into_value()); - } - 12u8 => { - r#hr_source = Some(field.into_value()); - } - 13u8 => { - r#speed_source = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#update_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("update_time", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#vo2_max = Some(_value); + } + Err(value) => { + invalid_fields.insert("vo2_max", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sport", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sub_sport = Some(_value); + } + Err(value) => { + invalid_fields.insert("sub_sport", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_met_category = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_met_category", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#calibrated_data = Some(_value); + } + Err(value) => { + invalid_fields.insert("calibrated_data", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#hr_source = Some(_value); + } + Err(value) => { + invalid_fields.insert("hr_source", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#speed_source = Some(_value); + } + Err(value) => { + invalid_fields.insert("speed_source", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10375,8 +17099,12 @@ impl FitMessage for MaxMetData { r#calibrated_data, r#hr_source, r#speed_source, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for MaxMetData { type Error = TryFromRecordError; @@ -10387,11 +17115,12 @@ impl TryFrom for MaxMetData { #[doc = "Body battery data used for HSA custom data logging"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HsaBodyBatteryData { - pub r#processing_interval: Option, - pub r#level: Option, - pub r#charged: Option, - pub r#uncharged: Option, - pub r#timestamp: Option, + pub r#processing_interval: Option, + pub r#level: Option, + pub r#charged: Option, + pub r#uncharged: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HsaBodyBatteryData { const NAME: &'static str = "HsaBodyBatteryData"; @@ -10408,23 +17137,50 @@ impl FitMessage for HsaBodyBatteryData { let mut r#charged = None; let mut r#uncharged = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#processing_interval = Some(field.into_value()); - } - 1u8 => { - r#level = Some(field.into_value()); - } - 2u8 => { - r#charged = Some(field.into_value()); - } - 3u8 => { - r#uncharged = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#processing_interval = Some(_value); + } + Err(value) => { + invalid_fields.insert("processing_interval", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#level = Some(_value); + } + Err(value) => { + invalid_fields.insert("level", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#charged = Some(_value); + } + Err(value) => { + invalid_fields.insert("charged", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#uncharged = Some(_value); + } + Err(value) => { + invalid_fields.insert("uncharged", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10438,8 +17194,12 @@ impl FitMessage for HsaBodyBatteryData { r#charged, r#uncharged, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HsaBodyBatteryData { type Error = TryFromRecordError; @@ -10450,8 +17210,9 @@ impl TryFrom for HsaBodyBatteryData { #[doc = "HSA events"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HsaEvent { - pub r#event_id: Option, - pub r#timestamp: Option, + pub r#event_id: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HsaEvent { const NAME: &'static str = "HsaEvent"; @@ -10465,14 +17226,26 @@ impl FitMessage for HsaEvent { } let mut r#event_id = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#event_id = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#event_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("event_id", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10483,8 +17256,12 @@ impl FitMessage for HsaEvent { Ok(Self { r#event_id, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HsaEvent { type Error = TryFromRecordError; @@ -10495,13 +17272,14 @@ impl TryFrom for HsaEvent { #[doc = "Raw accelerometer data used for HSA custom data logging"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HsaAccelerometerData { - pub r#timestamp_ms: Option, - pub r#sampling_interval: Option, - pub r#accel_x: Option, - pub r#accel_y: Option, - pub r#accel_z: Option, - pub r#timestamp_32k: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#sampling_interval: Option, + pub r#accel_x: Option, + pub r#accel_y: Option, + pub r#accel_z: Option, + pub r#timestamp_32k: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HsaAccelerometerData { const NAME: &'static str = "HsaAccelerometerData"; @@ -10520,29 +17298,66 @@ impl FitMessage for HsaAccelerometerData { let mut r#accel_z = None; let mut r#timestamp_32k = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#sampling_interval = Some(field.into_value()); - } - 2u8 => { - r#accel_x = Some(field.into_value()); - } - 3u8 => { - r#accel_y = Some(field.into_value()); - } - 4u8 => { - r#accel_z = Some(field.into_value()); - } - 5u8 => { - r#timestamp_32k = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sampling_interval = Some(_value); + } + Err(value) => { + invalid_fields.insert("sampling_interval", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#accel_x = Some(_value); + } + Err(value) => { + invalid_fields.insert("accel_x", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#accel_y = Some(_value); + } + Err(value) => { + invalid_fields.insert("accel_y", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#accel_z = Some(_value); + } + Err(value) => { + invalid_fields.insert("accel_z", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_32k = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_32k", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10558,8 +17373,12 @@ impl FitMessage for HsaAccelerometerData { r#accel_z, r#timestamp_32k, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HsaAccelerometerData { type Error = TryFromRecordError; @@ -10569,13 +17388,14 @@ impl TryFrom for HsaAccelerometerData { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HsaGyroscopeData { - pub r#timestamp_ms: Option, - pub r#sampling_interval: Option, - pub r#gyro_x: Option, - pub r#gyro_y: Option, - pub r#gyro_z: Option, - pub r#timestamp_32k: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#sampling_interval: Option, + pub r#gyro_x: Option, + pub r#gyro_y: Option, + pub r#gyro_z: Option, + pub r#timestamp_32k: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HsaGyroscopeData { const NAME: &'static str = "HsaGyroscopeData"; @@ -10594,29 +17414,66 @@ impl FitMessage for HsaGyroscopeData { let mut r#gyro_z = None; let mut r#timestamp_32k = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#sampling_interval = Some(field.into_value()); - } - 2u8 => { - r#gyro_x = Some(field.into_value()); - } - 3u8 => { - r#gyro_y = Some(field.into_value()); - } - 4u8 => { - r#gyro_z = Some(field.into_value()); - } - 5u8 => { - r#timestamp_32k = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sampling_interval = Some(_value); + } + Err(value) => { + invalid_fields.insert("sampling_interval", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gyro_x = Some(_value); + } + Err(value) => { + invalid_fields.insert("gyro_x", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gyro_y = Some(_value); + } + Err(value) => { + invalid_fields.insert("gyro_y", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gyro_z = Some(_value); + } + Err(value) => { + invalid_fields.insert("gyro_z", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_32k = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_32k", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10632,8 +17489,12 @@ impl FitMessage for HsaGyroscopeData { r#gyro_z, r#timestamp_32k, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HsaGyroscopeData { type Error = TryFromRecordError; @@ -10644,9 +17505,10 @@ impl TryFrom for HsaGyroscopeData { #[doc = "User's current daily step data used for HSA custom data logging"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HsaStepData { - pub r#processing_interval: Option, - pub r#steps: Option, - pub r#timestamp: Option, + pub r#processing_interval: Option, + pub r#steps: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HsaStepData { const NAME: &'static str = "HsaStepData"; @@ -10661,17 +17523,34 @@ impl FitMessage for HsaStepData { let mut r#processing_interval = None; let mut r#steps = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#processing_interval = Some(field.into_value()); - } - 1u8 => { - r#steps = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#processing_interval = Some(_value); + } + Err(value) => { + invalid_fields.insert("processing_interval", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#steps = Some(_value); + } + Err(value) => { + invalid_fields.insert("steps", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10683,8 +17562,12 @@ impl FitMessage for HsaStepData { r#processing_interval, r#steps, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HsaStepData { type Error = TryFromRecordError; @@ -10695,10 +17578,11 @@ impl TryFrom for HsaStepData { #[doc = "User's current SpO2 data used for HSA custom data logging"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HsaSpo2Data { - pub r#processing_interval: Option, - pub r#reading_spo2: Option, - pub r#confidence: Option, - pub r#timestamp: Option, + pub r#processing_interval: Option, + pub r#reading_spo2: Option, + pub r#confidence: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HsaSpo2Data { const NAME: &'static str = "HsaSpo2Data"; @@ -10714,20 +17598,42 @@ impl FitMessage for HsaSpo2Data { let mut r#reading_spo2 = None; let mut r#confidence = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#processing_interval = Some(field.into_value()); - } - 1u8 => { - r#reading_spo2 = Some(field.into_value()); - } - 2u8 => { - r#confidence = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#processing_interval = Some(_value); + } + Err(value) => { + invalid_fields.insert("processing_interval", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#reading_spo2 = Some(_value); + } + Err(value) => { + invalid_fields.insert("reading_spo2", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#confidence = Some(_value); + } + Err(value) => { + invalid_fields.insert("confidence", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10740,8 +17646,12 @@ impl FitMessage for HsaSpo2Data { r#reading_spo2, r#confidence, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HsaSpo2Data { type Error = TryFromRecordError; @@ -10752,9 +17662,10 @@ impl TryFrom for HsaSpo2Data { #[doc = "User's current stress data used for HSA custom data logging"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HsaStressData { - pub r#processing_interval: Option, - pub r#stress_level: Option, - pub r#timestamp: Option, + pub r#processing_interval: Option, + pub r#stress_level: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HsaStressData { const NAME: &'static str = "HsaStressData"; @@ -10769,17 +17680,34 @@ impl FitMessage for HsaStressData { let mut r#processing_interval = None; let mut r#stress_level = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#processing_interval = Some(field.into_value()); - } - 1u8 => { - r#stress_level = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#processing_interval = Some(_value); + } + Err(value) => { + invalid_fields.insert("processing_interval", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#stress_level = Some(_value); + } + Err(value) => { + invalid_fields.insert("stress_level", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10791,8 +17719,12 @@ impl FitMessage for HsaStressData { r#processing_interval, r#stress_level, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HsaStressData { type Error = TryFromRecordError; @@ -10803,9 +17735,10 @@ impl TryFrom for HsaStressData { #[doc = "User's current respiration data used for HSA custom data logging"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HsaRespirationData { - pub r#processing_interval: Option, - pub r#respiration_rate: Option, - pub r#timestamp: Option, + pub r#processing_interval: Option, + pub r#respiration_rate: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HsaRespirationData { const NAME: &'static str = "HsaRespirationData"; @@ -10820,17 +17753,34 @@ impl FitMessage for HsaRespirationData { let mut r#processing_interval = None; let mut r#respiration_rate = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#processing_interval = Some(field.into_value()); - } - 1u8 => { - r#respiration_rate = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#processing_interval = Some(_value); + } + Err(value) => { + invalid_fields.insert("processing_interval", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("respiration_rate", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10842,8 +17792,12 @@ impl FitMessage for HsaRespirationData { r#processing_interval, r#respiration_rate, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HsaRespirationData { type Error = TryFromRecordError; @@ -10854,10 +17808,11 @@ impl TryFrom for HsaRespirationData { #[doc = "User's current heart rate data used for HSA custom data logging"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HsaHeartRateData { - pub r#processing_interval: Option, - pub r#status: Option, - pub r#heart_rate: Option, - pub r#timestamp: Option, + pub r#processing_interval: Option, + pub r#status: Option, + pub r#heart_rate: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HsaHeartRateData { const NAME: &'static str = "HsaHeartRateData"; @@ -10873,20 +17828,42 @@ impl FitMessage for HsaHeartRateData { let mut r#status = None; let mut r#heart_rate = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#processing_interval = Some(field.into_value()); - } - 1u8 => { - r#status = Some(field.into_value()); - } - 2u8 => { - r#heart_rate = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#processing_interval = Some(_value); + } + Err(value) => { + invalid_fields.insert("processing_interval", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#status = Some(_value); + } + Err(value) => { + invalid_fields.insert("status", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#heart_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("heart_rate", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10899,8 +17876,12 @@ impl FitMessage for HsaHeartRateData { r#status, r#heart_rate, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HsaHeartRateData { type Error = TryFromRecordError; @@ -10911,9 +17892,10 @@ impl TryFrom for HsaHeartRateData { #[doc = "Configuration data for HSA custom data logging"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HsaConfigurationData { - pub r#data: Option, - pub r#data_size: Option, - pub r#timestamp: Option, + pub r#data: Option, + pub r#data_size: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HsaConfigurationData { const NAME: &'static str = "HsaConfigurationData"; @@ -10928,17 +17910,34 @@ impl FitMessage for HsaConfigurationData { let mut r#data = None; let mut r#data_size = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#data = Some(field.into_value()); - } - 1u8 => { - r#data_size = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#data = Some(_value); + } + Err(value) => { + invalid_fields.insert("data", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#data_size = Some(_value); + } + Err(value) => { + invalid_fields.insert("data_size", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -10950,8 +17949,12 @@ impl FitMessage for HsaConfigurationData { r#data, r#data_size, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HsaConfigurationData { type Error = TryFromRecordError; @@ -10962,9 +17965,10 @@ impl TryFrom for HsaConfigurationData { #[doc = "Wrist temperature data used for HSA custom data logging"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HsaWristTemperatureData { - pub r#processing_interval: Option, - pub r#value: Option, - pub r#timestamp: Option, + pub r#processing_interval: Option, + pub r#value: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HsaWristTemperatureData { const NAME: &'static str = "HsaWristTemperatureData"; @@ -10979,17 +17983,34 @@ impl FitMessage for HsaWristTemperatureData { let mut r#processing_interval = None; let mut r#value = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#processing_interval = Some(field.into_value()); - } - 1u8 => { - r#value = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#processing_interval = Some(_value); + } + Err(value) => { + invalid_fields.insert("processing_interval", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#value = Some(_value); + } + Err(value) => { + invalid_fields.insert("value", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11001,8 +18022,12 @@ impl FitMessage for HsaWristTemperatureData { r#processing_interval, r#value, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HsaWristTemperatureData { type Error = TryFromRecordError; @@ -11012,12 +18037,13 @@ impl TryFrom for HsaWristTemperatureData { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct MemoGlob { - pub r#memo: Option, - pub r#mesg_num: Option, - pub r#parent_index: Option, - pub r#field_num: Option, - pub r#data: Option, - pub r#part_index: Option, + pub r#memo: Option, + pub r#mesg_num: Option, + pub r#parent_index: Option, + pub r#field_num: Option, + pub r#data: Option, + pub r#part_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for MemoGlob { const NAME: &'static str = "MemoGlob"; @@ -11035,26 +18061,58 @@ impl FitMessage for MemoGlob { let mut r#field_num = None; let mut r#data = None; let mut r#part_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#memo = Some(field.into_value()); - } - 1u8 => { - r#mesg_num = Some(field.into_value()); - } - 2u8 => { - r#parent_index = Some(field.into_value()); - } - 3u8 => { - r#field_num = Some(field.into_value()); - } - 4u8 => { - r#data = Some(field.into_value()); - } - 250u8 => { - r#part_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#memo = Some(_value); + } + Err(value) => { + invalid_fields.insert("memo", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mesg_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("mesg_num", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#parent_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("parent_index", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#field_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("field_num", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#data = Some(_value); + } + Err(value) => { + invalid_fields.insert("data", value); + } + }, + 250u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#part_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("part_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11069,8 +18127,12 @@ impl FitMessage for MemoGlob { r#field_num, r#data, r#part_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for MemoGlob { type Error = TryFromRecordError; @@ -11080,8 +18142,9 @@ impl TryFrom for MemoGlob { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct SleepLevel { - pub r#sleep_level: Option, - pub r#timestamp: Option, + pub r#sleep_level: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for SleepLevel { const NAME: &'static str = "SleepLevel"; @@ -11095,14 +18158,26 @@ impl FitMessage for SleepLevel { } let mut r#sleep_level = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#sleep_level = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sleep_level = Some(_value); + } + Err(value) => { + invalid_fields.insert("sleep_level", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11113,8 +18188,12 @@ impl FitMessage for SleepLevel { Ok(Self { r#sleep_level, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for SleepLevel { type Error = TryFromRecordError; @@ -11124,11 +18203,12 @@ impl TryFrom for SleepLevel { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct AntChannelId { - pub r#channel_number: Option, - pub r#device_type: Option, - pub r#device_number: Option, - pub r#transmission_type: Option, - pub r#device_index: Option, + pub r#channel_number: Option, + pub r#device_type: Option, + pub r#device_number: Option, + pub r#transmission_type: Option, + pub r#device_index: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for AntChannelId { const NAME: &'static str = "AntChannelId"; @@ -11145,23 +18225,50 @@ impl FitMessage for AntChannelId { let mut r#device_number = None; let mut r#transmission_type = None; let mut r#device_index = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#channel_number = Some(field.into_value()); - } - 1u8 => { - r#device_type = Some(field.into_value()); - } - 2u8 => { - r#device_number = Some(field.into_value()); - } - 3u8 => { - r#transmission_type = Some(field.into_value()); - } - 4u8 => { - r#device_index = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#channel_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("channel_number", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#device_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("device_type", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#device_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("device_number", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#transmission_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("transmission_type", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#device_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("device_index", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11175,8 +18282,12 @@ impl FitMessage for AntChannelId { r#device_number, r#transmission_type, r#device_index, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for AntChannelId { type Error = TryFromRecordError; @@ -11186,12 +18297,13 @@ impl TryFrom for AntChannelId { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct AntRx { - pub r#fractional_timestamp: Option, - pub r#mesg_id: Option, - pub r#mesg_data: Option, - pub r#channel_number: Option, - pub r#data: Option, - pub r#timestamp: Option, + pub r#fractional_timestamp: Option, + pub r#mesg_id: Option, + pub r#mesg_data: Option, + pub r#channel_number: Option, + pub r#data: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for AntRx { const NAME: &'static str = "AntRx"; @@ -11209,26 +18321,58 @@ impl FitMessage for AntRx { let mut r#channel_number = None; let mut r#data = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#fractional_timestamp = Some(field.into_value()); - } - 1u8 => { - r#mesg_id = Some(field.into_value()); - } - 2u8 => { - r#mesg_data = Some(field.into_value()); - } - 3u8 => { - r#channel_number = Some(field.into_value()); - } - 4u8 => { - r#data = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#fractional_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("fractional_timestamp", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mesg_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("mesg_id", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mesg_data = Some(_value); + } + Err(value) => { + invalid_fields.insert("mesg_data", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#channel_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("channel_number", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#data = Some(_value); + } + Err(value) => { + invalid_fields.insert("data", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11243,8 +18387,12 @@ impl FitMessage for AntRx { r#channel_number, r#data, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for AntRx { type Error = TryFromRecordError; @@ -11254,12 +18402,13 @@ impl TryFrom for AntRx { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct AntTx { - pub r#fractional_timestamp: Option, - pub r#mesg_id: Option, - pub r#mesg_data: Option, - pub r#channel_number: Option, - pub r#data: Option, - pub r#timestamp: Option, + pub r#fractional_timestamp: Option, + pub r#mesg_id: Option, + pub r#mesg_data: Option, + pub r#channel_number: Option, + pub r#data: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for AntTx { const NAME: &'static str = "AntTx"; @@ -11277,26 +18426,58 @@ impl FitMessage for AntTx { let mut r#channel_number = None; let mut r#data = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#fractional_timestamp = Some(field.into_value()); - } - 1u8 => { - r#mesg_id = Some(field.into_value()); - } - 2u8 => { - r#mesg_data = Some(field.into_value()); - } - 3u8 => { - r#channel_number = Some(field.into_value()); - } - 4u8 => { - r#data = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#fractional_timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("fractional_timestamp", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mesg_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("mesg_id", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#mesg_data = Some(_value); + } + Err(value) => { + invalid_fields.insert("mesg_data", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#channel_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("channel_number", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#data = Some(_value); + } + Err(value) => { + invalid_fields.insert("data", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11311,8 +18492,12 @@ impl FitMessage for AntTx { r#channel_number, r#data, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for AntTx { type Error = TryFromRecordError; @@ -11322,10 +18507,11 @@ impl TryFrom for AntTx { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct ExdScreenConfiguration { - pub r#screen_index: Option, - pub r#field_count: Option, - pub r#layout: Option, - pub r#screen_enabled: Option, + pub r#screen_index: Option, + pub r#field_count: Option, + pub r#layout: Option, + pub r#screen_enabled: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for ExdScreenConfiguration { const NAME: &'static str = "ExdScreenConfiguration"; @@ -11341,20 +18527,42 @@ impl FitMessage for ExdScreenConfiguration { let mut r#field_count = None; let mut r#layout = None; let mut r#screen_enabled = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#screen_index = Some(field.into_value()); - } - 1u8 => { - r#field_count = Some(field.into_value()); - } - 2u8 => { - r#layout = Some(field.into_value()); - } - 3u8 => { - r#screen_enabled = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#screen_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("screen_index", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#field_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("field_count", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#layout = Some(_value); + } + Err(value) => { + invalid_fields.insert("layout", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#screen_enabled = Some(_value); + } + Err(value) => { + invalid_fields.insert("screen_enabled", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11367,8 +18575,12 @@ impl FitMessage for ExdScreenConfiguration { r#field_count, r#layout, r#screen_enabled, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for ExdScreenConfiguration { type Error = TryFromRecordError; @@ -11378,12 +18590,13 @@ impl TryFrom for ExdScreenConfiguration { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct ExdDataFieldConfiguration { - pub r#screen_index: Option, - pub r#concept_field: Option, - pub r#field_id: Option, - pub r#concept_count: Option, - pub r#display_type: Option, - pub r#title: Option, + pub r#screen_index: Option, + pub r#concept_field: Option, + pub r#field_id: Option, + pub r#concept_count: Option, + pub r#display_type: Option, + pub r#title: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for ExdDataFieldConfiguration { const NAME: &'static str = "ExdDataFieldConfiguration"; @@ -11401,26 +18614,58 @@ impl FitMessage for ExdDataFieldConfiguration { let mut r#concept_count = None; let mut r#display_type = None; let mut r#title = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#screen_index = Some(field.into_value()); - } - 1u8 => { - r#concept_field = Some(field.into_value()); - } - 2u8 => { - r#field_id = Some(field.into_value()); - } - 3u8 => { - r#concept_count = Some(field.into_value()); - } - 4u8 => { - r#display_type = Some(field.into_value()); - } - 5u8 => { - r#title = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#screen_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("screen_index", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#concept_field = Some(_value); + } + Err(value) => { + invalid_fields.insert("concept_field", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#field_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("field_id", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#concept_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("concept_count", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#display_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("display_type", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#title = Some(_value); + } + Err(value) => { + invalid_fields.insert("title", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11435,8 +18680,12 @@ impl FitMessage for ExdDataFieldConfiguration { r#concept_count, r#display_type, r#title, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for ExdDataFieldConfiguration { type Error = TryFromRecordError; @@ -11446,17 +18695,18 @@ impl TryFrom for ExdDataFieldConfiguration { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct ExdDataConceptConfiguration { - pub r#screen_index: Option, - pub r#concept_field: Option, - pub r#field_id: Option, - pub r#concept_index: Option, - pub r#data_page: Option, - pub r#concept_key: Option, - pub r#scaling: Option, - pub r#data_units: Option, - pub r#qualifier: Option, - pub r#descriptor: Option, - pub r#is_signed: Option, + pub r#screen_index: Option, + pub r#concept_field: Option, + pub r#field_id: Option, + pub r#concept_index: Option, + pub r#data_page: Option, + pub r#concept_key: Option, + pub r#scaling: Option, + pub r#data_units: Option, + pub r#qualifier: Option, + pub r#descriptor: Option, + pub r#is_signed: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for ExdDataConceptConfiguration { const NAME: &'static str = "ExdDataConceptConfiguration"; @@ -11479,41 +18729,98 @@ impl FitMessage for ExdDataConceptConfiguration { let mut r#qualifier = None; let mut r#descriptor = None; let mut r#is_signed = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#screen_index = Some(field.into_value()); - } - 1u8 => { - r#concept_field = Some(field.into_value()); - } - 2u8 => { - r#field_id = Some(field.into_value()); - } - 3u8 => { - r#concept_index = Some(field.into_value()); - } - 4u8 => { - r#data_page = Some(field.into_value()); - } - 5u8 => { - r#concept_key = Some(field.into_value()); - } - 6u8 => { - r#scaling = Some(field.into_value()); - } - 8u8 => { - r#data_units = Some(field.into_value()); - } - 9u8 => { - r#qualifier = Some(field.into_value()); - } - 10u8 => { - r#descriptor = Some(field.into_value()); - } - 11u8 => { - r#is_signed = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#screen_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("screen_index", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#concept_field = Some(_value); + } + Err(value) => { + invalid_fields.insert("concept_field", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#field_id = Some(_value); + } + Err(value) => { + invalid_fields.insert("field_id", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#concept_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("concept_index", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#data_page = Some(_value); + } + Err(value) => { + invalid_fields.insert("data_page", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#concept_key = Some(_value); + } + Err(value) => { + invalid_fields.insert("concept_key", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#scaling = Some(_value); + } + Err(value) => { + invalid_fields.insert("scaling", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#data_units = Some(_value); + } + Err(value) => { + invalid_fields.insert("data_units", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#qualifier = Some(_value); + } + Err(value) => { + invalid_fields.insert("qualifier", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#descriptor = Some(_value); + } + Err(value) => { + invalid_fields.insert("descriptor", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#is_signed = Some(_value); + } + Err(value) => { + invalid_fields.insert("is_signed", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11533,8 +18840,12 @@ impl FitMessage for ExdDataConceptConfiguration { r#qualifier, r#descriptor, r#is_signed, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for ExdDataConceptConfiguration { type Error = TryFromRecordError; @@ -11544,29 +18855,30 @@ impl TryFrom for ExdDataConceptConfiguration { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct DiveSummary { - pub r#reference_mesg: Option, - pub r#reference_index: Option, - pub r#avg_depth: Option, - pub r#max_depth: Option, - pub r#surface_interval: Option, - pub r#start_cns: Option, - pub r#end_cns: Option, - pub r#start_n2: Option, - pub r#end_n2: Option, - pub r#o2_toxicity: Option, - pub r#dive_number: Option, - pub r#bottom_time: Option, - pub r#avg_pressure_sac: Option, - pub r#avg_volume_sac: Option, - pub r#avg_rmv: Option, - pub r#descent_time: Option, - pub r#ascent_time: Option, - pub r#avg_ascent_rate: Option, - pub r#avg_descent_rate: Option, - pub r#max_ascent_rate: Option, - pub r#max_descent_rate: Option, - pub r#hang_time: Option, - pub r#timestamp: Option, + pub r#reference_mesg: Option, + pub r#reference_index: Option, + pub r#avg_depth: Option, + pub r#max_depth: Option, + pub r#surface_interval: Option, + pub r#start_cns: Option, + pub r#end_cns: Option, + pub r#start_n2: Option, + pub r#end_n2: Option, + pub r#o2_toxicity: Option, + pub r#dive_number: Option, + pub r#bottom_time: Option, + pub r#avg_pressure_sac: Option, + pub r#avg_volume_sac: Option, + pub r#avg_rmv: Option, + pub r#descent_time: Option, + pub r#ascent_time: Option, + pub r#avg_ascent_rate: Option, + pub r#avg_descent_rate: Option, + pub r#max_ascent_rate: Option, + pub r#max_descent_rate: Option, + pub r#hang_time: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for DiveSummary { const NAME: &'static str = "DiveSummary"; @@ -11589,89 +18901,206 @@ impl FitMessage for DiveSummary { let mut r#end_n2 = None; let mut r#o2_toxicity = None; let mut r#dive_number = None; - let mut r#bottom_time = None; - let mut r#avg_pressure_sac = None; - let mut r#avg_volume_sac = None; - let mut r#avg_rmv = None; - let mut r#descent_time = None; - let mut r#ascent_time = None; - let mut r#avg_ascent_rate = None; - let mut r#avg_descent_rate = None; - let mut r#max_ascent_rate = None; - let mut r#max_descent_rate = None; - let mut r#hang_time = None; - let mut r#timestamp = None; - for field in record.into_vec() { - match field.number() { - 0u8 => { - r#reference_mesg = Some(field.into_value()); - } - 1u8 => { - r#reference_index = Some(field.into_value()); - } - 2u8 => { - r#avg_depth = Some(field.into_value()); - } - 3u8 => { - r#max_depth = Some(field.into_value()); - } - 4u8 => { - r#surface_interval = Some(field.into_value()); - } - 5u8 => { - r#start_cns = Some(field.into_value()); - } - 6u8 => { - r#end_cns = Some(field.into_value()); - } - 7u8 => { - r#start_n2 = Some(field.into_value()); - } - 8u8 => { - r#end_n2 = Some(field.into_value()); - } - 9u8 => { - r#o2_toxicity = Some(field.into_value()); - } - 10u8 => { - r#dive_number = Some(field.into_value()); - } - 11u8 => { - r#bottom_time = Some(field.into_value()); - } - 12u8 => { - r#avg_pressure_sac = Some(field.into_value()); - } - 13u8 => { - r#avg_volume_sac = Some(field.into_value()); - } - 14u8 => { - r#avg_rmv = Some(field.into_value()); - } - 15u8 => { - r#descent_time = Some(field.into_value()); - } - 16u8 => { - r#ascent_time = Some(field.into_value()); - } - 17u8 => { - r#avg_ascent_rate = Some(field.into_value()); - } - 22u8 => { - r#avg_descent_rate = Some(field.into_value()); - } - 23u8 => { - r#max_ascent_rate = Some(field.into_value()); - } - 24u8 => { - r#max_descent_rate = Some(field.into_value()); - } - 25u8 => { - r#hang_time = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + let mut r#bottom_time = None; + let mut r#avg_pressure_sac = None; + let mut r#avg_volume_sac = None; + let mut r#avg_rmv = None; + let mut r#descent_time = None; + let mut r#ascent_time = None; + let mut r#avg_ascent_rate = None; + let mut r#avg_descent_rate = None; + let mut r#max_ascent_rate = None; + let mut r#max_descent_rate = None; + let mut r#hang_time = None; + let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); + for field in record.into_vec() { + match field.number() { + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#reference_mesg = Some(_value); + } + Err(value) => { + invalid_fields.insert("reference_mesg", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#reference_index = Some(_value); + } + Err(value) => { + invalid_fields.insert("reference_index", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_depth", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_depth = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_depth", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#surface_interval = Some(_value); + } + Err(value) => { + invalid_fields.insert("surface_interval", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_cns = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_cns", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_cns = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_cns", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_n2 = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_n2", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_n2 = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_n2", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#o2_toxicity = Some(_value); + } + Err(value) => { + invalid_fields.insert("o2_toxicity", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#dive_number = Some(_value); + } + Err(value) => { + invalid_fields.insert("dive_number", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#bottom_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("bottom_time", value); + } + }, + 12u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_pressure_sac = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_pressure_sac", value); + } + }, + 13u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_volume_sac = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_volume_sac", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_rmv = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_rmv", value); + } + }, + 15u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#descent_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("descent_time", value); + } + }, + 16u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#ascent_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("ascent_time", value); + } + }, + 17u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_ascent_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_ascent_rate", value); + } + }, + 22u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_descent_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_descent_rate", value); + } + }, + 23u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_ascent_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_ascent_rate", value); + } + }, + 24u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_descent_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_descent_rate", value); + } + }, + 25u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#hang_time = Some(_value); + } + Err(value) => { + invalid_fields.insert("hang_time", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11703,8 +19132,12 @@ impl FitMessage for DiveSummary { r#max_descent_rate, r#hang_time, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for DiveSummary { type Error = TryFromRecordError; @@ -11715,12 +19148,13 @@ impl TryFrom for DiveSummary { #[doc = "Number of acclerometer zero crossings summed over the specified time interval"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct AadAccelFeatures { - pub r#time: Option, - pub r#energy_total: Option, - pub r#zero_cross_cnt: Option, - pub r#instance: Option, - pub r#time_above_threshold: Option, - pub r#timestamp: Option, + pub r#time: Option, + pub r#energy_total: Option, + pub r#zero_cross_cnt: Option, + pub r#instance: Option, + pub r#time_above_threshold: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for AadAccelFeatures { const NAME: &'static str = "AadAccelFeatures"; @@ -11738,26 +19172,58 @@ impl FitMessage for AadAccelFeatures { let mut r#instance = None; let mut r#time_above_threshold = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#time = Some(field.into_value()); - } - 1u8 => { - r#energy_total = Some(field.into_value()); - } - 2u8 => { - r#zero_cross_cnt = Some(field.into_value()); - } - 3u8 => { - r#instance = Some(field.into_value()); - } - 4u8 => { - r#time_above_threshold = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time = Some(_value); + } + Err(value) => { + invalid_fields.insert("time", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#energy_total = Some(_value); + } + Err(value) => { + invalid_fields.insert("energy_total", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#zero_cross_cnt = Some(_value); + } + Err(value) => { + invalid_fields.insert("zero_cross_cnt", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#instance = Some(_value); + } + Err(value) => { + invalid_fields.insert("instance", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time_above_threshold = Some(_value); + } + Err(value) => { + invalid_fields.insert("time_above_threshold", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11772,8 +19238,12 @@ impl FitMessage for AadAccelFeatures { r#instance, r#time_above_threshold, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for AadAccelFeatures { type Error = TryFromRecordError; @@ -11784,7 +19254,8 @@ impl TryFrom for AadAccelFeatures { #[doc = "Heart rate variability"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct Hrv { - pub r#time: Option, + pub r#time: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for Hrv { const NAME: &'static str = "Hrv"; @@ -11797,11 +19268,18 @@ impl FitMessage for Hrv { return Err(TryFromRecordError::unexpected_message_kind::(&record)); } let mut r#time = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#time = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time = Some(_value); + } + Err(value) => { + invalid_fields.insert("time", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11809,7 +19287,13 @@ impl FitMessage for Hrv { } } } - Ok(Self { r#time }) + Ok(Self { + r#time, + invalid_fields, + }) + } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields } } impl TryFrom for Hrv { @@ -11821,9 +19305,10 @@ impl TryFrom for Hrv { #[doc = "Array of heart beat intervals"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct BeatIntervals { - pub r#timestamp_ms: Option, - pub r#time: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#time: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for BeatIntervals { const NAME: &'static str = "BeatIntervals"; @@ -11838,17 +19323,34 @@ impl FitMessage for BeatIntervals { let mut r#timestamp_ms = None; let mut r#time = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#time = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time = Some(_value); + } + Err(value) => { + invalid_fields.insert("time", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11860,8 +19362,12 @@ impl FitMessage for BeatIntervals { r#timestamp_ms, r#time, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for BeatIntervals { type Error = TryFromRecordError; @@ -11871,14 +19377,15 @@ impl TryFrom for BeatIntervals { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HrvStatusSummary { - pub r#weekly_average: Option, - pub r#last_night_average: Option, - pub r#last_night_5_min_high: Option, - pub r#baseline_low_upper: Option, - pub r#baseline_balanced_lower: Option, - pub r#baseline_balanced_upper: Option, - pub r#status: Option, - pub r#timestamp: Option, + pub r#weekly_average: Option, + pub r#last_night_average: Option, + pub r#last_night_5_min_high: Option, + pub r#baseline_low_upper: Option, + pub r#baseline_balanced_lower: Option, + pub r#baseline_balanced_upper: Option, + pub r#status: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HrvStatusSummary { const NAME: &'static str = "HrvStatusSummary"; @@ -11898,32 +19405,74 @@ impl FitMessage for HrvStatusSummary { let mut r#baseline_balanced_upper = None; let mut r#status = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#weekly_average = Some(field.into_value()); - } - 1u8 => { - r#last_night_average = Some(field.into_value()); - } - 2u8 => { - r#last_night_5_min_high = Some(field.into_value()); - } - 3u8 => { - r#baseline_low_upper = Some(field.into_value()); - } - 4u8 => { - r#baseline_balanced_lower = Some(field.into_value()); - } - 5u8 => { - r#baseline_balanced_upper = Some(field.into_value()); - } - 6u8 => { - r#status = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#weekly_average = Some(_value); + } + Err(value) => { + invalid_fields.insert("weekly_average", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#last_night_average = Some(_value); + } + Err(value) => { + invalid_fields.insert("last_night_average", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#last_night_5_min_high = Some(_value); + } + Err(value) => { + invalid_fields.insert("last_night_5_min_high", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#baseline_low_upper = Some(_value); + } + Err(value) => { + invalid_fields.insert("baseline_low_upper", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#baseline_balanced_lower = Some(_value); + } + Err(value) => { + invalid_fields.insert("baseline_balanced_lower", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#baseline_balanced_upper = Some(_value); + } + Err(value) => { + invalid_fields.insert("baseline_balanced_upper", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#status = Some(_value); + } + Err(value) => { + invalid_fields.insert("status", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11940,8 +19489,12 @@ impl FitMessage for HrvStatusSummary { r#baseline_balanced_upper, r#status, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HrvStatusSummary { type Error = TryFromRecordError; @@ -11951,8 +19504,9 @@ impl TryFrom for HrvStatusSummary { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct HrvValue { - pub r#value: Option, - pub r#timestamp: Option, + pub r#value: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for HrvValue { const NAME: &'static str = "HrvValue"; @@ -11966,14 +19520,26 @@ impl FitMessage for HrvValue { } let mut r#value = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#value = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#value = Some(_value); + } + Err(value) => { + invalid_fields.insert("value", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -11984,8 +19550,12 @@ impl FitMessage for HrvValue { Ok(Self { r#value, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for HrvValue { type Error = TryFromRecordError; @@ -11996,12 +19566,13 @@ impl TryFrom for HrvValue { #[doc = "Raw Beat-to-Beat Interval values"] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct RawBbi { - pub r#timestamp_ms: Option, - pub r#data: Option, - pub r#time: Option, - pub r#quality: Option, - pub r#gap: Option, - pub r#timestamp: Option, + pub r#timestamp_ms: Option, + pub r#data: Option, + pub r#time: Option, + pub r#quality: Option, + pub r#gap: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for RawBbi { const NAME: &'static str = "RawBbi"; @@ -12019,26 +19590,58 @@ impl FitMessage for RawBbi { let mut r#quality = None; let mut r#gap = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#timestamp_ms = Some(field.into_value()); - } - 1u8 => { - r#data = Some(field.into_value()); - } - 2u8 => { - r#time = Some(field.into_value()); - } - 3u8 => { - r#quality = Some(field.into_value()); - } - 4u8 => { - r#gap = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp_ms = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp_ms", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#data = Some(_value); + } + Err(value) => { + invalid_fields.insert("data", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#time = Some(_value); + } + Err(value) => { + invalid_fields.insert("time", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#quality = Some(_value); + } + Err(value) => { + invalid_fields.insert("quality", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#gap = Some(_value); + } + Err(value) => { + invalid_fields.insert("gap", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -12053,8 +19656,12 @@ impl FitMessage for RawBbi { r#quality, r#gap, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for RawBbi { type Error = TryFromRecordError; @@ -12064,8 +19671,9 @@ impl TryFrom for RawBbi { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct RespirationRate { - pub r#respiration_rate: Option, - pub r#timestamp: Option, + pub r#respiration_rate: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for RespirationRate { const NAME: &'static str = "RespirationRate"; @@ -12079,14 +19687,26 @@ impl FitMessage for RespirationRate { } let mut r#respiration_rate = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#respiration_rate = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#respiration_rate = Some(_value); + } + Err(value) => { + invalid_fields.insert("respiration_rate", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -12097,8 +19717,12 @@ impl FitMessage for RespirationRate { Ok(Self { r#respiration_rate, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for RespirationRate { type Error = TryFromRecordError; @@ -12109,13 +19733,14 @@ impl TryFrom for RespirationRate { #[doc = "Specifically used for XERO products."] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct ChronoShotSession { - pub r#min_speed: Option, - pub r#max_speed: Option, - pub r#avg_speed: Option, - pub r#shot_count: Option, - pub r#projectile_type: Option, - pub r#grain_weight: Option, - pub r#timestamp: Option, + pub r#min_speed: Option, + pub r#max_speed: Option, + pub r#avg_speed: Option, + pub r#shot_count: Option, + pub r#projectile_type: Option, + pub r#grain_weight: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for ChronoShotSession { const NAME: &'static str = "ChronoShotSession"; @@ -12134,29 +19759,66 @@ impl FitMessage for ChronoShotSession { let mut r#projectile_type = None; let mut r#grain_weight = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#min_speed = Some(field.into_value()); - } - 1u8 => { - r#max_speed = Some(field.into_value()); - } - 2u8 => { - r#avg_speed = Some(field.into_value()); - } - 3u8 => { - r#shot_count = Some(field.into_value()); - } - 4u8 => { - r#projectile_type = Some(field.into_value()); - } - 5u8 => { - r#grain_weight = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#min_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("min_speed", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#max_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("max_speed", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#avg_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("avg_speed", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#shot_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("shot_count", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#projectile_type = Some(_value); + } + Err(value) => { + invalid_fields.insert("projectile_type", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#grain_weight = Some(_value); + } + Err(value) => { + invalid_fields.insert("grain_weight", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -12172,8 +19834,12 @@ impl FitMessage for ChronoShotSession { r#projectile_type, r#grain_weight, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for ChronoShotSession { type Error = TryFromRecordError; @@ -12184,9 +19850,10 @@ impl TryFrom for ChronoShotSession { #[doc = "Specifically used for XERO products."] #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct ChronoShotData { - pub r#shot_speed: Option, - pub r#shot_num: Option, - pub r#timestamp: Option, + pub r#shot_speed: Option, + pub r#shot_num: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for ChronoShotData { const NAME: &'static str = "ChronoShotData"; @@ -12201,17 +19868,34 @@ impl FitMessage for ChronoShotData { let mut r#shot_speed = None; let mut r#shot_num = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#shot_speed = Some(field.into_value()); - } - 1u8 => { - r#shot_num = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#shot_speed = Some(_value); + } + Err(value) => { + invalid_fields.insert("shot_speed", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#shot_num = Some(_value); + } + Err(value) => { + invalid_fields.insert("shot_num", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -12223,8 +19907,12 @@ impl FitMessage for ChronoShotData { r#shot_speed, r#shot_num, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for ChronoShotData { type Error = TryFromRecordError; @@ -12234,9 +19922,10 @@ impl TryFrom for ChronoShotData { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct TankUpdate { - pub r#sensor: Option, - pub r#pressure: Option, - pub r#timestamp: Option, + pub r#sensor: Option, + pub r#pressure: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for TankUpdate { const NAME: &'static str = "TankUpdate"; @@ -12251,17 +19940,34 @@ impl FitMessage for TankUpdate { let mut r#sensor = None; let mut r#pressure = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#sensor = Some(field.into_value()); - } - 1u8 => { - r#pressure = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sensor = Some(_value); + } + Err(value) => { + invalid_fields.insert("sensor", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#pressure = Some(_value); + } + Err(value) => { + invalid_fields.insert("pressure", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -12273,8 +19979,12 @@ impl FitMessage for TankUpdate { r#sensor, r#pressure, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for TankUpdate { type Error = TryFromRecordError; @@ -12284,11 +19994,12 @@ impl TryFrom for TankUpdate { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct TankSummary { - pub r#sensor: Option, - pub r#start_pressure: Option, - pub r#end_pressure: Option, - pub r#volume_used: Option, - pub r#timestamp: Option, + pub r#sensor: Option, + pub r#start_pressure: Option, + pub r#end_pressure: Option, + pub r#volume_used: Option, + pub r#timestamp: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for TankSummary { const NAME: &'static str = "TankSummary"; @@ -12305,23 +20016,50 @@ impl FitMessage for TankSummary { let mut r#end_pressure = None; let mut r#volume_used = None; let mut r#timestamp = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#sensor = Some(field.into_value()); - } - 1u8 => { - r#start_pressure = Some(field.into_value()); - } - 2u8 => { - r#end_pressure = Some(field.into_value()); - } - 3u8 => { - r#volume_used = Some(field.into_value()); - } - 253u8 => { - r#timestamp = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sensor = Some(_value); + } + Err(value) => { + invalid_fields.insert("sensor", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#start_pressure = Some(_value); + } + Err(value) => { + invalid_fields.insert("start_pressure", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#end_pressure = Some(_value); + } + Err(value) => { + invalid_fields.insert("end_pressure", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#volume_used = Some(_value); + } + Err(value) => { + invalid_fields.insert("volume_used", value); + } + }, + 253u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#timestamp = Some(_value); + } + Err(value) => { + invalid_fields.insert("timestamp", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -12335,8 +20073,12 @@ impl FitMessage for TankSummary { r#end_pressure, r#volume_used, r#timestamp, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for TankSummary { type Error = TryFromRecordError; @@ -12346,20 +20088,21 @@ impl TryFrom for TankSummary { } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct SleepAssessment { - pub r#combined_awake_score: Option, - pub r#awake_time_score: Option, - pub r#awakenings_count_score: Option, - pub r#deep_sleep_score: Option, - pub r#sleep_duration_score: Option, - pub r#light_sleep_score: Option, - pub r#overall_sleep_score: Option, - pub r#sleep_quality_score: Option, - pub r#sleep_recovery_score: Option, - pub r#rem_sleep_score: Option, - pub r#sleep_restlessness_score: Option, - pub r#awakenings_count: Option, - pub r#interruptions_score: Option, - pub r#average_stress_during_sleep: Option, + pub r#combined_awake_score: Option, + pub r#awake_time_score: Option, + pub r#awakenings_count_score: Option, + pub r#deep_sleep_score: Option, + pub r#sleep_duration_score: Option, + pub r#light_sleep_score: Option, + pub r#overall_sleep_score: Option, + pub r#sleep_quality_score: Option, + pub r#sleep_recovery_score: Option, + pub r#rem_sleep_score: Option, + pub r#sleep_restlessness_score: Option, + pub r#awakenings_count: Option, + pub r#interruptions_score: Option, + pub r#average_stress_during_sleep: Option, + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for SleepAssessment { const NAME: &'static str = "SleepAssessment"; @@ -12385,50 +20128,122 @@ impl FitMessage for SleepAssessment { let mut r#awakenings_count = None; let mut r#interruptions_score = None; let mut r#average_stress_during_sleep = None; + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { - 0u8 => { - r#combined_awake_score = Some(field.into_value()); - } - 1u8 => { - r#awake_time_score = Some(field.into_value()); - } - 2u8 => { - r#awakenings_count_score = Some(field.into_value()); - } - 3u8 => { - r#deep_sleep_score = Some(field.into_value()); - } - 4u8 => { - r#sleep_duration_score = Some(field.into_value()); - } - 5u8 => { - r#light_sleep_score = Some(field.into_value()); - } - 6u8 => { - r#overall_sleep_score = Some(field.into_value()); - } - 7u8 => { - r#sleep_quality_score = Some(field.into_value()); - } - 8u8 => { - r#sleep_recovery_score = Some(field.into_value()); - } - 9u8 => { - r#rem_sleep_score = Some(field.into_value()); - } - 10u8 => { - r#sleep_restlessness_score = Some(field.into_value()); - } - 11u8 => { - r#awakenings_count = Some(field.into_value()); - } - 14u8 => { - r#interruptions_score = Some(field.into_value()); - } - 15u8 => { - r#average_stress_during_sleep = Some(field.into_value()); - } + 0u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#combined_awake_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("combined_awake_score", value); + } + }, + 1u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#awake_time_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("awake_time_score", value); + } + }, + 2u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#awakenings_count_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("awakenings_count_score", value); + } + }, + 3u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#deep_sleep_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("deep_sleep_score", value); + } + }, + 4u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sleep_duration_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("sleep_duration_score", value); + } + }, + 5u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#light_sleep_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("light_sleep_score", value); + } + }, + 6u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#overall_sleep_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("overall_sleep_score", value); + } + }, + 7u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sleep_quality_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("sleep_quality_score", value); + } + }, + 8u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sleep_recovery_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("sleep_recovery_score", value); + } + }, + 9u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#rem_sleep_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("rem_sleep_score", value); + } + }, + 10u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#sleep_restlessness_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("sleep_restlessness_score", value); + } + }, + 11u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#awakenings_count = Some(_value); + } + Err(value) => { + invalid_fields.insert("awakenings_count", value); + } + }, + 14u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#interruptions_score = Some(_value); + } + Err(value) => { + invalid_fields.insert("interruptions_score", value); + } + }, + 15u8 => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + r#average_stress_during_sleep = Some(_value); + } + Err(value) => { + invalid_fields.insert("average_stress_during_sleep", value); + } + }, _ => { if !options.ignore_unexpected_fields { return Err(TryFromRecordError::unexpected_field(&field)); @@ -12451,8 +20266,12 @@ impl FitMessage for SleepAssessment { r#awakenings_count, r#interruptions_score, r#average_stress_during_sleep, + invalid_fields, }) } + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for SleepAssessment { type Error = TryFromRecordError; diff --git a/fitparser/src/profile/mod.rs b/fitparser/src/profile/mod.rs index 4defde2..6ca2111 100644 --- a/fitparser/src/profile/mod.rs +++ b/fitparser/src/profile/mod.rs @@ -2,13 +2,14 @@ //! interpreted without using the FIT profile. use crate::de::DecodeOption; use crate::error::{ErrorKind, Result}; -use crate::{FitDataField, FitDataRecord, Value}; +use crate::{FitDataField, FitDataRecord, Value, ValueWithUnits}; use chrono::{DateTime, Duration, Local, NaiveDate, TimeZone}; -use std::collections::{HashMap, HashSet}; +use std::collections::{BTreeMap, HashMap, HashSet}; use std::convert::TryInto; use std::error::Error; use std::f64::EPSILON; use std::fmt; +use std::str::FromStr; pub mod field_types; pub use field_types::{get_field_variant_as_string, FieldDataType, MesgNum}; @@ -294,6 +295,31 @@ fn apply_scale_and_offset(value: Value, scale: f64, offset: f64) -> Result Result; + + fn from_value(value: Value) -> Result { + Self::from_value_with_units(ValueWithUnits::new(value, String::new())) + } +} + +impl FromValue for ValueWithUnits { + fn from_value_with_units(value: ValueWithUnits) -> Result { + Ok(value) + } +} + +fn parse_enum + FromStr>(value: ValueWithUnits) -> Result { + // TODO: how to handle units for int-based enums like Weight or Timestamp? + if let Ok(i) = TryInto::::try_into(&value.value) { + Ok(i.into()) + } else if let Value::String(s) = &value.value { + s.parse().map_err(|_| value) + } else { + Err(value) + } +} + /// A message type. pub trait FitMessage { /// The name of this message type. @@ -316,6 +342,9 @@ pub trait FitMessage { ) -> Result where Self: Sized; + + /// Return all invalid fields in this message. + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits>; } /// Options for [`FitMessage::parse_with_options`][]. @@ -382,3 +411,15 @@ impl fmt::Display for TryFromRecordError { } impl Error for TryFromRecordError {} + +/// An error when parsing an enum variant from a string. +#[derive(Debug)] +pub struct EnumFromStrError; + +impl fmt::Display for EnumFromStrError { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(fmt, "failed to parse enum: no such variant") + } +} + +impl Error for EnumFromStrError {} diff --git a/generate-fit-profile/src/field_types.rs b/generate-fit-profile/src/field_types.rs index 2c3ac9b..7859972 100644 --- a/generate-fit-profile/src/field_types.rs +++ b/generate-fit-profile/src/field_types.rs @@ -171,6 +171,32 @@ impl FieldTypeDefintion { writeln!(out, "}}")?; writeln!(out, "}}")?; + writeln!(out, "impl FromStr for {} {{", self.titlized_name())?; + writeln!(out, " type Err = EnumFromStrError;")?; + writeln!(out, " fn from_str(s: &str) -> Result {{")?; + writeln!(out, " match s {{")?; + for variant in self.variant_map().values() { + writeln!( + out, + " \"{}\" => Ok(Self::{}),", + variant.name(), + variant.titlized_name() + )?; + } + writeln!(out, " _ => Err(EnumFromStrError),")?; + writeln!(out, " }}")?; + writeln!(out, " }}")?; + writeln!(out, "}}")?; + + writeln!(out, "impl FromValue for {} {{", self.titlized_name())?; + writeln!( + out, + " fn from_value_with_units(value: ValueWithUnits) -> Result {{" + )?; + writeln!(out, " super::parse_enum(value)")?; + writeln!(out, " }}")?; + writeln!(out, "}}")?; + Ok(()) } } @@ -292,6 +318,9 @@ pub fn write_types_file(profile: &FitProfile, out: &mut File) -> Result<(), std: writeln!(out, "use serde::ser::Serializer;")?; writeln!(out, "use std::convert;")?; writeln!(out, "use std::fmt;")?; + writeln!(out, "use std::str::FromStr;")?; + writeln!(out, "use super::{{EnumFromStrError, FromValue}};")?; + writeln!(out, "use crate::ValueWithUnits;")?; // output enums and implementations for field_type in profile.field_types() { diff --git a/generate-fit-profile/src/messages.rs b/generate-fit-profile/src/messages.rs index 7d93583..eb94ceb 100644 --- a/generate-fit-profile/src/messages.rs +++ b/generate-fit-profile/src/messages.rs @@ -1,6 +1,6 @@ //! Functions to generate the message structs in Rust from the fit profile. -use crate::parse::{FitProfile, MessageDefinition, MessageFieldDefinition}; +use crate::parse::{FitProfile, MessageDefinition, MessageFieldDefinition, MessageFieldType}; use proc_macro2::TokenStream; use quote::quote; use std::{ @@ -8,10 +8,22 @@ use std::{ io::{Error, Write}, }; +fn converted_field_type(field: &MessageFieldDefinition) -> Option { + if field.is_array() { + None + } else { + match field.field_type() { + MessageFieldType::Enum(ident) => Some(quote! { field_types::#ident }), + MessageFieldType::Raw(_) => None, + } + } +} + fn message_struct_field(field: &MessageFieldDefinition) -> TokenStream { let ident = field.field_ident(); + let ty = converted_field_type(field).unwrap_or_else(|| quote! { ValueWithUnits }); quote! { - pub #ident: Option, + pub #ident: Option<#ty>, } } @@ -24,10 +36,16 @@ fn field_variable(field: &MessageFieldDefinition) -> TokenStream { fn field_match_case(field: &MessageFieldDefinition) -> TokenStream { let number = field.def_number(); + let name = field.name(); let ident = field.field_ident(); quote! { - #number => { - #ident = Some(field.into_value()); + #number => match FromValue::from_value_with_units(field.into()) { + Ok(_value) => { + #ident = Some(_value); + } + Err(value) => { + invalid_fields.insert(#name, value); + } } } } @@ -42,6 +60,8 @@ fn message_parse_impl(message: &MessageDefinition) -> TokenStream { return Err(TryFromRecordError::unexpected_message_kind::(&record)); } #( #field_variables )* + #[allow(unused_mut)] + let mut invalid_fields = BTreeMap::new(); for field in record.into_vec() { match field.number() { #( #field_match_cases )* @@ -51,7 +71,8 @@ fn message_parse_impl(message: &MessageDefinition) -> TokenStream { } } Ok(Self { - #( #field_idents ),* + #( #field_idents, )* + invalid_fields, }) } } @@ -61,7 +82,7 @@ fn message_struct(message: &MessageDefinition) -> TokenStream { let ident = message.struct_ident(); let comment = message.comment().into_iter(); - let struct_fields = message.field_map().values().map(message_struct_field); + let struct_fields = message.fields().map(message_struct_field); let parse_impl = message_parse_impl(message); quote! { @@ -69,6 +90,7 @@ fn message_struct(message: &MessageDefinition) -> TokenStream { #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize)] pub struct #ident { #( #struct_fields )* + pub invalid_fields: BTreeMap<&'static str, ValueWithUnits>, } impl FitMessage for #ident { @@ -81,6 +103,10 @@ fn message_struct(message: &MessageDefinition) -> TokenStream { ) -> Result { #parse_impl } + + fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + &self.invalid_fields + } } impl TryFrom for #ident { @@ -122,6 +148,13 @@ fn message_enum(messages: &[MessageDefinition]) -> TokenStream { kind => Err(TryFromRecordError::UnsupportedMessageKind(kind)), } } + + /// Return all invalid fields in this message. + pub fn invalid_fields(&self) -> &BTreeMap<&'static str, ValueWithUnits> { + match self { + #( Self::#idents(message) => message.invalid_fields(), )* + } + } } } } @@ -137,8 +170,12 @@ pub fn write_messages_file(profile: &FitProfile, out: &mut File) -> Result<(), E #![allow(missing_docs)] #![doc = #comment] - use crate::{FitDataRecord, Value, profile::{FitMessage, MessageParseOptions, MesgNum, TryFromRecordError}}; + use crate::{ + FitDataRecord, ValueWithUnits, + profile::{FitMessage, FromValue, MessageParseOptions, MesgNum, TryFromRecordError, field_types}, + }; use serde::Serialize; + use std::collections::BTreeMap; #message_enum diff --git a/generate-fit-profile/src/parse.rs b/generate-fit-profile/src/parse.rs index 633562e..9cc6428 100644 --- a/generate-fit-profile/src/parse.rs +++ b/generate-fit-profile/src/parse.rs @@ -3,6 +3,7 @@ use calamine::{open_workbook, DataType, Range, Reader, Xlsx}; use proc_macro2::Ident; use quote::format_ident; use std::collections::{BTreeMap, HashMap}; +use std::fmt; use std::path::PathBuf; // the fields in these structs are mostly duplicated from code in src/profile/parser.rs @@ -186,7 +187,7 @@ pub struct MessageFieldDefinition { def_number: u8, name: String, field_ident: Ident, - field_type: String, + field_type: MessageFieldType, is_array: bool, scale: f64, offset: f64, @@ -204,7 +205,7 @@ impl MessageFieldDefinition { fn new( def_number: u8, name: &str, - field_type: &str, + field_type: MessageFieldType, is_array: bool, scale: f64, offset: f64, @@ -217,7 +218,7 @@ impl MessageFieldDefinition { def_number, name: name.to_string(), field_ident: format_ident!("r#{}", name), - field_type: field_type_str_to_field_type(field_type), + field_type, is_array, scale, offset, @@ -243,7 +244,7 @@ impl MessageFieldDefinition { &self.field_ident } - pub fn field_type(&self) -> &str { + pub fn field_type(&self) -> &MessageFieldType { &self.field_type } @@ -296,6 +297,51 @@ impl MessageFieldDefinition { } } +#[derive(Clone, Debug)] +pub enum MessageFieldType { + Enum(Ident), + Raw(String), +} + +impl MessageFieldType { + fn new(fields: &[FieldTypeDefintion], field_type: &str) -> Self { + if let Some(field) = fields.iter().find(|field| field.name() == field_type) { + if !field.variant_map().is_empty() { + return Self::Enum(format_ident!("{}", field.titlized_name())); + } + } + let raw = match field_type { + "sint8" => "SInt8".to_string(), + "uint8" => "UInt8".to_string(), + "sint16" => "SInt16".to_string(), + "uint16" => "UInt16".to_string(), + "sint32" => "SInt32".to_string(), + "uint32" => "UInt32".to_string(), + "string" => "String".to_string(), + "float32" => "Float32".to_string(), + "float64" => "Float64".to_string(), + "uint8z" => "UInt8z".to_string(), + "uint16z" => "UInt16z".to_string(), + "uint32z" => "UInt32z".to_string(), + "byte" => "Byte".to_string(), + "sint64" => "SInt64".to_string(), + "uint64" => "UInt64".to_string(), + "uint64z" => "UInt64z".to_string(), + _ => titlecase_string(field_type), + }; + Self::Raw(raw) + } +} + +impl fmt::Display for MessageFieldType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Enum(ident) => ident.fmt(f), + Self::Raw(raw) => raw.fmt(f), + } + } +} + #[derive(Clone, Debug)] pub struct MessageFieldComponent { name: String, @@ -348,29 +394,6 @@ fn base_type_to_rust_type(base_type_str: &str) -> &'static str { } } -/// match the field type string to a simple type or an enum -fn field_type_str_to_field_type(field_type_str: &str) -> String { - match field_type_str { - "sint8" => "SInt8".to_string(), - "uint8" => "UInt8".to_string(), - "sint16" => "SInt16".to_string(), - "uint16" => "UInt16".to_string(), - "sint32" => "SInt32".to_string(), - "uint32" => "UInt32".to_string(), - "string" => "String".to_string(), - "float32" => "Float32".to_string(), - "float64" => "Float64".to_string(), - "uint8z" => "UInt8z".to_string(), - "uint16z" => "UInt16z".to_string(), - "uint32z" => "UInt32z".to_string(), - "byte" => "Byte".to_string(), - "sint64" => "SInt64".to_string(), - "uint64" => "UInt64".to_string(), - "uint64z" => "UInt64z".to_string(), - _ => titlecase_string(field_type_str), - } -} - fn titlecase_string(value: &str) -> String { let mut words: Vec = value .split('_') @@ -549,7 +572,10 @@ fn process_components( } #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] -fn new_message_field_definition(row: &[DataType]) -> MessageFieldDefinition { +fn new_message_field_definition( + fields: &[FieldTypeDefintion], + row: &[DataType], +) -> MessageFieldDefinition { let def_number = match row[1] { DataType::Float(v) => v as u8, DataType::Int(v) => v as u8, @@ -561,14 +587,15 @@ fn new_message_field_definition(row: &[DataType]) -> MessageFieldDefinition { let ftype = row[3] .get_string() .unwrap_or_else(|| panic!("Field type must be a string, row={row:?}.")); + let field_type = MessageFieldType::new(fields, ftype); let components = parse_message_field_components(row); let comment = row[13].get_string().map(std::string::ToString::to_string); MessageFieldDefinition::new( def_number, name, - ftype, - row[4].is_empty(), + field_type, + !row[4].is_empty(), row[6].get_float().unwrap_or(1.0), row[7].get_float().unwrap_or(0.0), row[8].get_string().unwrap_or(""), @@ -578,7 +605,10 @@ fn new_message_field_definition(row: &[DataType]) -> MessageFieldDefinition { ) } -fn process_messages(sheet: &Range) -> Vec { +fn process_messages( + fields: &[FieldTypeDefintion], + sheet: &Range, +) -> Vec { let mut rows = sheet.rows().skip(1); let mut messages: Vec = Vec::new(); let mut msg: MessageDefinition; @@ -613,7 +643,7 @@ fn process_messages(sheet: &Range) -> Vec { panic!("Message name must be a string row={row:?}."); } } else if !row[1].is_empty() { - field = new_message_field_definition(row); + field = new_message_field_definition(fields, row); last_def_number = field.def_number; msg.field_map.insert(field.def_number, field); } else if !row[2].is_empty() { @@ -624,7 +654,7 @@ fn process_messages(sheet: &Range) -> Vec { .expect("No parent field defined for subfield!"); let mut temp_row: Vec = Vec::from(row); temp_row[1] = DataType::Int(i64::from(last_def_number)); - field = new_message_field_definition(&temp_row); + field = new_message_field_definition(fields, &temp_row); // store subfield ref_field, ref_field_value and defintion, if multiple values can // trigger this subfield we simply duplicate them let ref_field_names = row[11].get_string().expect("No reference field name(s)"); @@ -661,7 +691,7 @@ pub fn parse_profile( // process Messages sheet let messages = if let Some(Ok(sheet)) = excel.worksheet_range("Messages") { - process_messages(&sheet) + process_messages(&field_types, &sheet) } else { panic!("Could not access workbook sheet 'Messages'"); };