### DecoderBuilder::new Source: https://docs.rs/rustyfit/0.10.0/rustyfit/struct.DecoderBuilder.html Creates a new instance of DecoderBuilder to start configuring a Decoder. ```APIDOC ## DecoderBuilder::new ### Description Creates a new DecoderBuilder. ### Method `new()` ### Returns - `Self`: A new DecoderBuilder instance. ``` -------------------------------- ### TrainingSettings Methods Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.TrainingSettings.html Provides methods for creating, setting, and getting scaled values for training settings. ```APIDOC ### impl TrainingSettings #### pub const fn new() -> Self Create new TrainingSettings with all fields being set to its corresponding invalid value. #### pub fn target_distance_scaled(&self) -> Option Returns `target_distance` in its scaled value. It returns `None` when value is invalid. Units: m #### pub fn set_target_distance_scaled(&mut self, v: f64) -> &mut Self Set `target_distance` with scaled value, it will automatically be converted to its corresponding integer value. #### pub fn target_speed_scaled(&self) -> Option Returns `target_speed` in its scaled value. It returns `None` when value is invalid. Units: m/s #### pub fn set_target_speed_scaled(&mut self, v: f64) -> &mut Self Set `target_speed` with scaled value, it will automatically be converted to its corresponding integer value. #### pub fn precise_target_speed_scaled(&self) -> Option Returns `precise_target_speed` in its scaled value. It returns `None` when value is invalid. Units: m/s #### pub fn set_precise_target_speed_scaled(&mut self, v: f64) -> &mut Self Set `precise_target_speed` with scaled value, it will automatically be converted to its corresponding integer value. ``` -------------------------------- ### CloneToUninit Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.AntplusDeviceType.html Nightly-only experimental API for cloning to uninitialized memory. ```APIDOC ## unsafe fn clone_to_uninit(&self, dest: *mut u8) ### Description Performs copy-assignment from `self` to `dest`. ### Method `clone_to_uninit` ### Parameters - `dest` (*mut u8): A mutable pointer to the destination memory. ### Safety This function is unsafe as it operates on raw pointers and requires careful management of memory. ``` -------------------------------- ### Start Position Longitude Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Lap.html Methods for getting and setting the start position longitude in degrees. ```APIDOC ## pub fn start_position_long_degrees(&self) -> Option ### Description Returns `start_position_long` in degrees instead of semicircles. It returns `None` when value is invalid. ### Method `start_position_long_degrees()` ### Returns `Option` - The start longitude in degrees, or `None` if invalid. ``` ```APIDOC ## pub fn set_start_position_long_degrees(&mut self, v: f64) -> &mut Self ### Description Set `start_position_long` with a value in degrees instead of semicircles, the value will be converted to semicircles. ### Method `set_start_position_long_degrees(v: f64)` ### Parameters - **v** (f64) - The longitude value in degrees. ### Returns `&mut Self` - A mutable reference to the Lap instance. ``` -------------------------------- ### Start Position Latitude Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Lap.html Methods for getting and setting the start position latitude in degrees. ```APIDOC ## pub fn start_position_lat_degrees(&self) -> Option ### Description Returns `start_position_lat` in degrees instead of semicircles. It returns `None` when value is invalid. ### Method `start_position_lat_degrees()` ### Returns `Option` - The start latitude in degrees, or `None` if invalid. ``` ```APIDOC ## pub fn set_start_position_lat_degrees(&mut self, v: f64) -> &mut Self ### Description Set `start_position_lat` with a value in degrees instead of semicircles, the value will be converted to semicircles. ### Method `set_start_position_lat_degrees(v: f64)` ### Parameters - **v** (f64) - The latitude value in degrees. ### Returns `&mut Self` - A mutable reference to the Lap instance. ``` -------------------------------- ### Decode a FIT File Source: https://docs.rs/rustyfit/0.10.0/rustyfit/index.html This example demonstrates how to decode a FIT file using the Decoder. It shows how to read the file, process messages, and extract specific information like file ID and session details. Requires `embedded-io-adapters` for std usage. ```rust use embedded_io_adapters::std::FromStd; use rustyfit::{Decoder, profile::{mesgdef, typedef}, proto::Value}; use std::{error::Error, fs::File, io::BufReader}; fn main() -> Result<(), Box> { let name = "tests/data/from_official_sdk/Activity.fit"; let f = File::open(name)?; let br = BufReader::new(f); let mut reader = FromStd::new(br); let mut dec = Decoder::new(); let Some(fit) = dec.decode(&mut reader)? else { return Ok(()); // reader is empty from the start, skip. }; println!("file_header's data_size: {}", fit.file_header.data_size); println!("messages count: {}", fit.messages.len()); for mesg in &fit.messages { match mesg.num { typedef::MesgNum::FILE_ID => { // We can manually iterate over fields for field in &mesg.fields { if field.num == mesgdef::FileId::TYPE && let Value::Uint8(v) = field.value { println!("file_id:\n file_type: {}", typedef::File(v)); } } } typedef::MesgNum::SESSION => { // But it's more convenience to convert mesg into mesgdef's struct. let ses = mesgdef::Session::from(mesg); println!( "session:\n start_time: {:?}\n sport: {}\n num_laps: {}", ses.start_time.unix_timestamp(), ses.sport, ses.num_laps ); } _ => {} } } Ok(()) // # Output: // // file_header's data_size: 94080 // messages count: 3611 // file_id: // file_type: activity // session: // start_time: Some(1626815480) // sport: stand_up_paddleboarding // num_laps: 1 } ``` -------------------------------- ### Get Scaled Start Pressure Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.TankSummary.html Retrieves the start pressure value scaled to its appropriate units (bar). Returns None if the value is invalid. ```rust pub fn start_pressure_scaled(&self) -> Option ``` -------------------------------- ### WktStepTarget Clone Implementation Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.WktStepTarget.html Demonstrates the `clone` and `clone_from` methods for the WktStepTarget struct, allowing for duplication and assignment of WktStepTarget values. ```rust fn clone(&self) -> WktStepTarget ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### PartialEq Implementation for IndoorBikeExerciseName Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.IndoorBikeExerciseName.html Enables equality comparison for IndoorBikeExerciseName instances. This allows checking if two exercise names are the same. ```rust fn eq(&self, other: &IndoorBikeExerciseName) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### Set Scaled Start Pressure Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.TankSummary.html Sets the start pressure using a scaled value (bar). The input value is automatically converted to its corresponding integer representation. ```rust pub fn set_start_pressure_scaled(&mut self, v: f64) -> &mut Self ``` -------------------------------- ### Cadence256 Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Record.html Methods for getting and setting the scaled cadence256 value. ```APIDOC ## set_cadence256_scaled ### Description Set `cadence256` with scaled value, it will automatically be converted to its corresponding integer value. ### Method `set_cadence256_scaled(&mut self, v: f64) -> &mut Self` ## cadence256_scaled ### Description Returns `cadence256` in its scaled value. It returns `None` when value is invalid. ### Method `cadence256_scaled(&self) -> Option` ### Units rpm ``` -------------------------------- ### ExdLayout Implementations Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.ExdLayout.html ExdLayout implements several standard traits, including Clone, Copy, Debug, Default, Display, and PartialEq. ```APIDOC ## ExdLayout Implementations ### `Clone` - `clone(&self) -> ExdLayout`: Returns a duplicate of the value. - `clone_from(&mut self, source: &Self)`: Performs copy-assignment from `source`. ### `Copy` - Implements the `Copy` trait, allowing for simple value copying. ### `Debug` - `fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### `Default` - `default() -> Self`: Returns the default value for `ExdLayout`. ### `Display` - `fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value for display. ### `PartialEq` - `eq(&self, other: &ExdLayout) -> bool`: Tests for equality between two `ExdLayout` instances. - `ne(&self, other: &ExdLayout) -> bool`: Tests for inequality between two `ExdLayout` instances. ``` -------------------------------- ### Time128 Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Record.html Methods for getting and setting the scaled time128 value. ```APIDOC ## set_time128_scaled ### Description Set `time128` with scaled value, it will automatically be converted to its corresponding integer value. ### Method `set_time128_scaled(&mut self, v: f64) -> &mut Self` ## time128_scaled ### Description Returns `time128` in its scaled value. It returns `None` when value is invalid. ### Method `time128_scaled(&self) -> Option` ### Units s ``` -------------------------------- ### ExdScreenConfiguration::clone() Method Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.ExdScreenConfiguration.html Returns a duplicate of the ExdScreenConfiguration value. ```rust fn clone(&self) -> ExdScreenConfiguration ``` -------------------------------- ### type_id Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.ConnectivityCapabilities.html Gets the TypeId of self. This method is part of the Any trait implementation. ```APIDOC ## fn type_id(&self) -> TypeId ### Description Gets the `TypeId` of `self`. ### Method `type_id` ### Parameters None ### Response #### Success Response (200) - **TypeId**: The unique identifier for the type of `self`. ``` -------------------------------- ### ExdLayout PartialEq Implementation Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.ExdLayout.html Enables comparison between ExdLayout instances for equality. This allows checking if two layout configurations are the same. ```rust fn eq(&self, other: &ExdLayout) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### Active Time Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Lap.html Methods to get and set the scaled active time. ```APIDOC ## pub fn active_time_scaled(&self) -> Option ### Description Returns `active_time` in its scaled value. It returns `None` when value is invalid. ### Units s ## pub fn set_active_time_scaled(&mut self, v: f64) -> &mut Self ### Description Set `active_time` with scaled value, it will automatically be converted to its corresponding integer value. ``` -------------------------------- ### WeightScale Methods Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.WeightScale.html Provides methods for creating, getting, and setting scaled values for various weight scale measurements. ```APIDOC ## WeightScale ### Description Represents a weight scale measurement, including various body composition metrics. ### Methods #### `new()` Creates a new `WeightScale` instance with all fields initialized to their invalid values. #### `weight_scaled(&self) -> Option` Returns the `weight` in its scaled value (kg). Returns `None` if the value is invalid. #### `set_weight_scaled(&mut self, v: f64) -> &mut Self` Sets the `weight` with a scaled value (kg). The value is automatically converted to its corresponding integer format. #### `percent_fat_scaled(&self) -> Option` Returns the `percent_fat` in its scaled value (%). Returns `None` if the value is invalid. #### `set_percent_fat_scaled(&mut self, v: f64) -> &mut Self` Sets the `percent_fat` with a scaled value (%). The value is automatically converted to its corresponding integer format. #### `percent_hydration_scaled(&self) -> Option` Returns the `percent_hydration` in its scaled value (%). Returns `None` if the value is invalid. #### `set_percent_hydration_scaled(&mut self, v: f64) -> &mut Self` Sets the `percent_hydration` with a scaled value (%). The value is automatically converted to its corresponding integer format. #### `visceral_fat_mass_scaled(&self) -> Option` Returns the `visceral_fat_mass` in its scaled value (kg). Returns `None` if the value is invalid. #### `set_visceral_fat_mass_scaled(&mut self, v: f64) -> &mut Self` Sets the `visceral_fat_mass` with a scaled value (kg). The value is automatically converted to its corresponding integer format. #### `bone_mass_scaled(&self) -> Option` Returns the `bone_mass` in its scaled value (kg). Returns `None` if the value is invalid. #### `set_bone_mass_scaled(&mut self, v: f64) -> &mut Self` Sets the `bone_mass` with a scaled value (kg). The value is automatically converted to its corresponding integer format. #### `muscle_mass_scaled(&self) -> Option` Returns the `muscle_mass` in its scaled value (kg). Returns `None` if the value is invalid. #### `set_muscle_mass_scaled(&mut self, v: f64) -> &mut Self` Sets the `muscle_mass` with a scaled value (kg). The value is automatically converted to its corresponding integer format. #### `basal_met_scaled(&self) -> Option` Returns the `basal_met` in its scaled value (kcal/day). Returns `None` if the value is invalid. #### `set_basal_met_scaled(&mut self, v: f64) -> &mut Self` Sets the `basal_met` with a scaled value (kcal/day). The value is automatically converted to its corresponding integer format. #### `active_met_scaled(&self) -> Option` Returns the `active_met` in its scaled value (kcal/day). Returns `None` if the value is invalid. #### `set_active_met_scaled(&mut self, v: f64) -> &mut Self` Sets the `active_met` with a scaled value (kcal/day). The value is automatically converted to its corresponding integer format. #### `bmi_scaled(&self) -> Option` Returns the `bmi` in its scaled value (kg/m^2). Returns `None` if the value is invalid. #### `set_bmi_scaled(&mut self, v: f64) -> &mut Self` Sets the `bmi` with a scaled value (kg/m^2). The value is automatically converted to its corresponding integer format. ``` -------------------------------- ### Min Altitude Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Lap.html Methods to get and set the scaled minimum altitude. ```APIDOC ## pub fn min_altitude_scaled(&self) -> Option ### Description Returns `min_altitude` in its scaled value. It returns `None` when value is invalid. ### Units m ## pub fn set_min_altitude_scaled(&mut self, v: f64) -> &mut Self ### Description Set `min_altitude` with scaled value, it will automatically be converted to its corresponding integer value. ``` -------------------------------- ### PartialEq Implementation for IndoorRowExerciseName Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.IndoorRowExerciseName.html Allows for the comparison of two IndoorRowExerciseName instances for equality. This is fundamental for checking if two exercise names are the same. ```rust fn eq(&self, other: &IndoorRowExerciseName) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### BattleRopeExerciseName Default Value Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.BattleRopeExerciseName.html Provides a method to get the default value for BattleRopeExerciseName. ```APIDOC ## fn default() -> Self ### Description Returns the default value for a type. ### Method default ### Returns The default BattleRopeExerciseName instance. ``` -------------------------------- ### Clone Implementation for IndoorBikeExerciseName Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.IndoorBikeExerciseName.html Demonstrates how to clone an IndoorBikeExerciseName instance. This allows for creating duplicates of exercise name values. ```rust fn clone(&self) -> IndoorBikeExerciseName ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### set_start_position_lat_degrees(&mut self, v: f64) -> &mut Self Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.SegmentLap.html Sets the starting latitude in degrees, converting the value to semicircles before storage. ```APIDOC ## set_start_position_lat_degrees(&mut self, v: f64) -> &mut Self ### Description Sets the starting latitude with a value in degrees instead of semicircles. The value will be converted to semicircles upon setting. ### Parameters - **v** (f64): The starting latitude in degrees. ### Returns - `&mut Self`: A mutable reference to the SegmentLap instance. ``` -------------------------------- ### Fractional Cadence Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Record.html Methods for getting and setting the scaled fractional cadence value. ```APIDOC ## set_fractional_cadence_scaled ### Description Set `fractional_cadence` with scaled value, it will automatically be converted to its corresponding integer value. ### Method `set_fractional_cadence_scaled(&mut self, v: f64) -> &mut Self` ## fractional_cadence_scaled ### Description Returns `fractional_cadence` in its scaled value. It returns `None` when value is invalid. ### Method `fractional_cadence_scaled(&self) -> Option` ### Units rpm ``` -------------------------------- ### BacklightMode PartialEq Implementation Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.BacklightMode.html Allows comparison of BacklightMode instances for equality. This is essential for checking if two backlight modes are the same. ```rust fn eq(&self, other: &BacklightMode) -> bool; ``` ```rust fn ne(&self, other: &Rhs) -> bool; ``` -------------------------------- ### Ball Speed Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Record.html Methods for getting and setting the scaled ball speed value. ```APIDOC ## set_ball_speed_scaled ### Description Set `ball_speed` with scaled value, it will automatically be converted to its corresponding integer value. ### Method `set_ball_speed_scaled(&mut self, v: f64) -> &mut Self` ## ball_speed_scaled ### Description Returns `ball_speed` in its scaled value. It returns `None` when value is invalid. ### Method `ball_speed_scaled(&self) -> Option` ### Units m/s ``` -------------------------------- ### PartialEq Implementation for BikeLightBeamAngleMode Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.BikeLightBeamAngleMode.html Illustrates the equality comparison for BikeLightBeamAngleMode, enabling checks for whether two modes are the same. ```rust fn eq(&self, other: &BikeLightBeamAngleMode) -> bool; ``` -------------------------------- ### Split Struct Methods Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Split.html Provides details on how to create, clone, and manage Split instances. ```APIDOC ## fn clone(&self) -> Split ### Description Returns a duplicate of the value. ### Method clone ### Parameters None ### Response - **Split**: A new instance of Split that is a duplicate of the original. ``` ```APIDOC ## fn clone_from(&mut self, source: &Self) ### Description Performs copy-assignment from `source`. ### Method clone_from ### Parameters - **source**: &Self - The source Split instance to copy from. ### Response None ``` ```APIDOC ## fn fmt(&self, f: &mut Formatter<'_>) -> Result ### Description Formats the value using the given formatter. ### Method fmt ### Parameters - **f**: &mut Formatter<'_> - The formatter to use. ### Response - **Result**: Ok(()) if formatting is successful, Err(std::fmt::Error) otherwise. ``` ```APIDOC ## fn default() -> Self ### Description Returns the “default value” for a type. ### Method default ### Parameters None ### Response - **Self**: The default Split instance. ``` ```APIDOC ## fn from(mesg: &Message) -> Self ### Description Creates a new Split struct based on the given `mesg`. ### Method from ### Parameters - **mesg**: &Message - The Message to create the Split from. ### Response - **Self**: A new Split instance created from the Message. ``` ```APIDOC ## fn from(m: Split) -> Self ### Description Converts a Split instance into a Message. ### Method from ### Parameters - **m**: Split - The Split instance to convert. ### Response - **Self**: The converted Message instance. ``` -------------------------------- ### Stance Time Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Record.html Methods for getting and setting the scaled stance time value. ```APIDOC ## set_stance_time_scaled ### Description Set `stance_time` with scaled value, it will automatically be converted to its corresponding integer value. ### Method `set_stance_time_scaled(&mut self, v: f64) -> &mut Self` ## stance_time_scaled ### Description Returns `stance_time` in its scaled value. It returns `None` when value is invalid. ### Method `stance_time_scaled(&self) -> Option` ### Units ms ``` -------------------------------- ### from() - VideoDescription to Message Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.VideoDescription.html Converts a VideoDescription struct into a Message. ```rust fn from(m: VideoDescription) -> Self ``` -------------------------------- ### Vertical Oscillation Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Record.html Methods for getting and setting the scaled vertical oscillation value. ```APIDOC ## set_vertical_oscillation_scaled ### Description Set `vertical_oscillation` with scaled value, it will automatically be converted to its corresponding integer value. ### Method `set_vertical_oscillation_scaled(&mut self, v: f64) -> &mut Self` ``` -------------------------------- ### End Position Latitude Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Lap.html Methods for getting and setting the end position latitude in degrees. ```APIDOC ## pub fn end_position_lat_degrees(&self) -> Option ### Description Returns `end_position_lat` in degrees instead of semicircles. It returns `None` when value is invalid. ### Method `end_position_lat_degrees()` ### Returns `Option` - The end latitude in degrees, or `None` if invalid. ``` ```APIDOC ## pub fn set_end_position_lat_degrees(&mut self, v: f64) -> &mut Self ### Description Set `end_position_lat` with a value in degrees instead of semicircles, the value will be converted to semicircles. ### Method `set_end_position_lat_degrees(v: f64)` ### Parameters - **v** (f64) - The latitude value in degrees. ### Returns `&mut Self` - A mutable reference to the Lap instance. ``` -------------------------------- ### CloneToUninit Implementation (Nightly) Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/lookup/struct.FieldReference.html Implements the experimental `clone_to_uninit` method for copying data to an uninitialized memory location. This is a nightly-only feature. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### FileCapabilities::new() Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.FileCapabilities.html Creates a new FileCapabilities instance with all fields initialized to their invalid default values. ```APIDOC #### pub fn new() -> Self Create new FileCapabilities with all fields being set to its corresponding invalid value. ``` -------------------------------- ### Active Time Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.SegmentLap.html Methods to get and set the active time in its scaled representation. ```APIDOC ## pub fn set_active_time_scaled(&mut self, v: f64) -> &mut Self ### Description Set `active_time` with scaled value, it will automatically be converted to its corresponding integer value. ### Method `set_active_time_scaled` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **v** (f64) - The scaled value for active time. ### Request Example ```rust // Example usage (assuming `segment_lap` is a mutable instance of SegmentLap) // segment_lap.set_active_time_scaled(1800.0); ``` ### Response Returns a mutable reference to `Self` for chaining. ``` ```APIDOC ## pub fn active_time_scaled(&self) -> Option ### Description Returns `active_time` in its scaled value. It returns `None` when value is invalid. Units: s ### Method `active_time_scaled` ### Parameters None ### Response #### Success Response (Option) - Returns `Some(f64)` containing the scaled active time if valid. - Returns `None` if the value is invalid. ### Response Example ```rust // Example usage (assuming `segment_lap` is an instance of SegmentLap) // let active_time = segment_lap.active_time_scaled(); // match active_time { // Some(value) => println!("Active Time: {} s", value), // None => println!("Active Time is invalid."), // } ``` ``` -------------------------------- ### Minimum Altitude Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.SegmentLap.html Methods to get and set the minimum altitude in its scaled representation. ```APIDOC ## pub fn set_min_altitude_scaled(&mut self, v: f64) -> &mut Self ### Description Set `min_altitude` with scaled value, it will automatically be converted to its corresponding integer value. ### Method `set_min_altitude_scaled` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **v** (f64) - The scaled value for minimum altitude. ### Request Example ```rust // Example usage (assuming `segment_lap` is a mutable instance of SegmentLap) // segment_lap.set_min_altitude_scaled(100.0); ``` ### Response Returns a mutable reference to `Self` for chaining. ``` ```APIDOC ## pub fn min_altitude_scaled(&self) -> Option ### Description Returns `min_altitude` in its scaled value. It returns `None` when value is invalid. Units: m ### Method `min_altitude_scaled` ### Parameters None ### Response #### Success Response (Option) - Returns `Some(f64)` containing the scaled minimum altitude if valid. - Returns `None` if the value is invalid. ### Response Example ```rust // Example usage (assuming `segment_lap` is an instance of SegmentLap) // let min_altitude = segment_lap.min_altitude_scaled(); // match min_altitude { // Some(value) => println!("Minimum Altitude: {} m", value), // None => println!("Minimum Altitude is invalid."), // } ``` ``` -------------------------------- ### PartialEq Implementation for FloorClimbExerciseName Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.FloorClimbExerciseName.html Illustrates the `eq` method for FloorClimbExerciseName, used for comparing two exercise names for equality. This is essential for checks and comparisons. ```rust fn eq(&self, other: &FloorClimbExerciseName) -> bool ``` -------------------------------- ### Session Struct Methods Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Session.html Provides documentation for the core methods available on the Session struct, including cloning, default value creation, and conversions. ```APIDOC ## fn clone(&self) -> Session ### Description Returns a duplicate of the value. ### Method clone ### Parameters None ### Response - **Session**: A new Session instance that is a duplicate of the original. ``` ```APIDOC ## fn clone_from(&mut self, source: &Self) ### Description Performs copy-assignment from `source`. ### Method clone_from ### Parameters - **source**: &Self - The source Session to copy from. ### Response None ``` ```APIDOC ## fn default() -> Self ### Description Returns the “default value” for a type. ### Method default ### Parameters None ### Response - **Self**: The default Session instance. ``` ```APIDOC ## fn from(mesg: &Message) -> Self ### Description Creates a new Session struct based on the given `mesg`. ### Method from ### Parameters - **mesg**: &Message - The Message to convert into a Session. ### Response - **Self**: A new Session instance created from the Message. ``` ```APIDOC ## fn from(m: Session) -> Self ### Description Converts a Session into a Message. ### Method from ### Parameters - **m**: Session - The Session to convert. ### Response - **Self**: The converted Message instance. ``` -------------------------------- ### Average Grade Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.SegmentLap.html Methods to get and set the average grade in its scaled value. ```APIDOC ## pub fn avg_grade_scaled(&self) -> Option ### Description Returns `avg_grade` in its scaled value. Units: % It returns `None` when value is invalid. ### Method GET ### Endpoint `/segment/lap/avg_grade_scaled` ### Response #### Success Response (200) - **avg_grade_scaled** (Option) - The average grade in percent (scaled). ## pub fn set_avg_grade_scaled(&mut self, v: f64) -> &mut Self ### Description Set `avg_grade` with scaled value, it will automatically be converted to its corresponding integer value. ### Method POST ### Endpoint `/segment/lap/set_avg_grade_scaled` ### Parameters #### Request Body - **v** (f64) - Required - The average grade in percent (scaled). ### Response #### Success Response (200) - **self** (&mut Self) - A mutable reference to the Segment Lap object. ``` -------------------------------- ### Max Altitude Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.SegmentLap.html Methods to get and set the maximum altitude in its scaled value. ```APIDOC ## pub fn max_altitude_scaled(&self) -> Option ### Description Returns `max_altitude` in its scaled value. Units: m It returns `None` when value is invalid. ### Method GET ### Endpoint `/segment/lap/max_altitude_scaled` ### Response #### Success Response (200) - **max_altitude_scaled** (Option) - The maximum altitude in meters (scaled). ## pub fn set_max_altitude_scaled(&mut self, v: f64) -> &mut Self ### Description Set `max_altitude` with scaled value, it will automatically be converted to its corresponding integer value. ### Method POST ### Endpoint `/segment/lap/set_max_altitude_scaled` ### Parameters #### Request Body - **v** (f64) - Required - The maximum altitude in meters (scaled). ### Response #### Success Response (200) - **self** (&mut Self) - A mutable reference to the Segment Lap object. ``` -------------------------------- ### ExdLayout Constants Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.ExdLayout.html ExdLayout provides constants for various screen layouts, including full screen, half splits, and dynamic layouts. ```APIDOC ## ExdLayout ### Constants - `FULL_SCREEN`: Represents a full-screen layout. - `HALF_VERTICAL`: Represents a layout split vertically in half. - `HALF_HORIZONTAL`: Represents a layout split horizontally in half. - `HALF_VERTICAL_RIGHT_SPLIT`: Represents a layout with the right side split vertically. - `HALF_HORIZONTAL_BOTTOM_SPLIT`: Represents a layout with the bottom split horizontally. - `FULL_QUARTER_SPLIT`: Represents a layout split into four quarters. - `HALF_VERTICAL_LEFT_SPLIT`: Represents a layout with the left side split vertically. - `HALF_HORIZONTAL_TOP_SPLIT`: Represents a layout with the top split horizontally. - `DYNAMIC`: The EXD may display the configured concepts in any layout it sees fit. ``` -------------------------------- ### Activity Implementations Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.Activity.html Details the various trait implementations for the Activity struct, including Clone, Copy, Debug, Default, Display, and PartialEq. ```APIDOC ## Implementations for Activity ### `impl Clone for Activity` * `fn clone(&self) -> Activity` - Returns a duplicate of the value. * `fn clone_from(&mut self, source: &Self)` - Performs copy-assignment from `source`. ### `impl Copy for Activity` Indicates that the type can be copied by simply moving the bits. ### `impl Debug for Activity` * `fn fmt(&self, f: &mut Formatter<'_>) -> Result` - Formats the value using the given formatter. ### `impl Default for Activity` * `fn default() -> Self` - Returns the default value for the Activity type. ### `impl Display for Activity` * `fn fmt(&self, f: &mut Formatter<'_>) -> Result` - Formats the value using the given formatter. ### `impl PartialEq for Activity` * `fn eq(&self, other: &Activity) -> bool` - Tests for equality between two Activity instances. * `fn ne(&self, other: &Activity) -> bool` - Tests for inequality between two Activity instances. ``` -------------------------------- ### Average Altitude Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.SegmentLap.html Methods to get and set the average altitude in its scaled value. ```APIDOC ## pub fn avg_altitude_scaled(&self) -> Option ### Description Returns `avg_altitude` in its scaled value. Units: m It returns `None` when value is invalid. ### Method GET ### Endpoint `/segment/lap/avg_altitude_scaled` ### Response #### Success Response (200) - **avg_altitude_scaled** (Option) - The average altitude in meters (scaled). ## pub fn set_avg_altitude_scaled(&mut self, v: f64) -> &mut Self ### Description Set `avg_altitude` with scaled value, it will automatically be converted to its corresponding integer value. ### Method POST ### Endpoint `/segment/lap/set_avg_altitude_scaled` ### Parameters #### Request Body - **v** (f64) - Required - The average altitude in meters (scaled). ### Response #### Success Response (200) - **self** (&mut Self) - A mutable reference to the Segment Lap object. ``` -------------------------------- ### Video Clone Implementation Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Video.html Provides the implementation for cloning a Video instance. ```rust fn clone(&self) -> Video ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Max Speed Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.SegmentLap.html Methods to get and set the maximum speed in its scaled value. ```APIDOC ## pub fn max_speed_scaled(&self) -> Option ### Description Returns `max_speed` in its scaled value. Units: m/s It returns `None` when value is invalid. ### Method GET ### Endpoint `/segment/lap/max_speed_scaled` ### Response #### Success Response (200) - **max_speed_scaled** (Option) - The maximum speed in meters per second (scaled). ## pub fn set_max_speed_scaled(&mut self, v: f64) -> &mut Self ### Description Set `max_speed` with scaled value, it will automatically be converted to its corresponding integer value. ### Method POST ### Endpoint `/segment/lap/set_max_speed_scaled` ### Parameters #### Request Body - **v** (f64) - Required - The maximum speed in meters per second (scaled). ### Response #### Success Response (200) - **self** (&mut Self) - A mutable reference to the Segment Lap object. ``` -------------------------------- ### Average Speed Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.SegmentLap.html Methods to get and set the average speed in its scaled value. ```APIDOC ## pub fn avg_speed_scaled(&self) -> Option ### Description Returns `avg_speed` in its scaled value. Units: m/s It returns `None` when value is invalid. ### Method GET ### Endpoint `/segment/lap/avg_speed_scaled` ### Response #### Success Response (200) - **avg_speed_scaled** (Option) - The average speed in meters per second (scaled). ## pub fn set_avg_speed_scaled(&mut self, v: f64) -> &mut Self ### Description Set `avg_speed` with scaled value, it will automatically be converted to its corresponding integer value. ### Method POST ### Endpoint `/segment/lap/set_avg_speed_scaled` ### Parameters #### Request Body - **v** (f64) - Required - The average speed in meters per second (scaled). ### Response #### Success Response (200) - **self** (&mut Self) - A mutable reference to the Segment Lap object. ``` -------------------------------- ### Serialize Rustyfit Record and Message to JSON Source: https://docs.rs/rustyfit/0.10.0/rustyfit/index.html Demonstrates serializing a `mesgdef::Record` and converting it to a `proto::Message` before serializing to JSON. Ensure the `serde` feature is enabled. ```rust fn main() {} use rustyfit::{profile::{mesgdef, typedef::{self, FitBaseType}}, proto::{Field, Message, Value}}; fn main() { let mut record = mesgdef::Record::new(); record.timestamp = typedef::DateTime::from_unix_timestamp(1781838455); record.position_lat = 424480360; record.position_long = -940295581; record.heart_rate = 70; record.distance = 50 * 100; record.activity_type = typedef::ActivityType::CYCLING; // typedef::ActivityType(2) record.unknown_fields = [Field { num: 254, base_type: FitBaseType::UINT8, value: Value::Uint8(10), is_expanded: false, }].into(); let s = serde_json::to_string_pretty(&record).unwrap(); println!("# Serialize from mesgdef::Record:\n{}\n", s); let mesg = Message::from(record); let s = serde_json::to_string_pretty(&mesg).unwrap(); println!("# Serialize from proto::Message:\n{}\n", s); } ``` -------------------------------- ### Clone Implementation for Course Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Course.html Provides methods for duplicating Course instances. ```rust fn clone(&self) -> Course ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Total Distance Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.SegmentLap.html Methods to get and set the total distance in its scaled value. ```APIDOC ## pub fn total_distance_scaled(&self) -> Option ### Description Returns `total_distance` in its scaled value. Units: m It returns `None` when value is invalid. ### Method GET ### Endpoint `/segment/lap/total_distance_scaled` ### Response #### Success Response (200) - **total_distance_scaled** (Option) - The total distance in meters (scaled). ## pub fn set_total_distance_scaled(&mut self, v: f64) -> &mut Self ### Description Set `total_distance` with scaled value, it will automatically be converted to its corresponding integer value. ### Method POST ### Endpoint `/segment/lap/set_total_distance_scaled` ### Parameters #### Request Body - **v** (f64) - Required - The total distance in meters (scaled). ### Response #### Success Response (200) - **self** (&mut Self) - A mutable reference to the Segment Lap object. ``` -------------------------------- ### End Position Longitude Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.SegmentLap.html Methods to get and set the end position longitude in degrees. ```APIDOC ## pub fn end_position_long_degrees(&self) -> Option ### Description Returns `end_position_long` in degrees instead of semicircles. It returns `None` when value is invalid. ### Method GET ### Endpoint `/segment/lap/end_position_long_degrees` ### Response #### Success Response (200) - **end_position_long_degrees** (Option) - The end position longitude in degrees. ## pub fn set_end_position_long_degrees(&mut self, v: f64) -> &mut Self ### Description Set `end_position_long` with a value in degrees instead of semicircles, the value will be converted to semicircles. ### Method POST ### Endpoint `/segment/lap/set_end_position_long_degrees` ### Parameters #### Request Body - **v** (f64) - Required - The end position longitude in degrees. ### Response #### Success Response (200) - **self** (&mut Self) - A mutable reference to the Segment Lap object. ``` -------------------------------- ### DeviceSettings Methods Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.DeviceSettings.html Methods available for interacting with DeviceSettings. ```APIDOC ## DeviceSettings Methods ### new() Create new DeviceSettings with all fields being set to its corresponding invalid value. ### time_zone_offset_scaled(&self) -> Option> Returns `time_zone_offset` in its scaled value. It returns `None` when value is invalid. Units: hr ### set_time_zone_offset_scaled(&mut self, v: &[f64]) -> &mut Self Set `time_zone_offset` with scaled value, it will automatically be converted to its corresponding integer value. ``` -------------------------------- ### Serialize Rustyfit Record to JSON Source: https://docs.rs/rustyfit Demonstrates serializing a `mesgdef::Record` and a `proto::Message` to JSON using the Serde feature. Ensure the 'serde' feature is enabled. ```rust use rustyfit::{profile::{mesgdef, typedef::{self, FitBaseType}}, proto::{Field, Message, Value}}; fn main() { let mut record = mesgdef::Record::new(); record.timestamp = typedef::DateTime::from_unix_timestamp(1781838455); record.position_lat = 424480360; record.position_long = -940295581; record.heart_rate = 70; record.distance = 50 * 100; record.activity_type = typedef::ActivityType::CYCLING; // typedef::ActivityType(2) record.unknown_fields = [Field { num: 254, base_type: FitBaseType::UINT8, value: Value::Uint8(10), is_expanded: false, }].into(); let s = serde_json::to_string_pretty(&record).unwrap(); println!("# Serialize from mesgdef::Record:\n{}\n", s); let mesg = Message::from(record); let s = serde_json::to_string_pretty(&mesg).unwrap(); println!("# Serialize from proto::Message:\n{}\n", s); } ``` -------------------------------- ### Speed Scaling Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Jump.html Provides methods to get and set the speed in its scaled value (m/s). ```rust pub fn speed_scaled(&self) -> Option ``` ```rust pub fn set_speed_scaled(&mut self, v: f64) -> &mut Self ``` -------------------------------- ### Total Fractional Cycles Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Lap.html Methods to get and set the scaled total fractional cycles. ```APIDOC ## pub fn total_fractional_cycles_scaled(&self) -> Option ### Description Returns `total_fractional_cycles` in its scaled value. It returns `None` when value is invalid. ### Units cycles ## pub fn set_total_fractional_cycles_scaled(&mut self, v: f64) -> &mut Self ### Description Set `total_fractional_cycles` with scaled value, it will automatically be converted to its corresponding integer value. ``` -------------------------------- ### ExdScreenConfiguration::from(ExdScreenConfiguration) Implementation Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.ExdScreenConfiguration.html Converts an ExdScreenConfiguration struct into a Message. ```rust fn from(m: ExdScreenConfiguration) -> Self ``` -------------------------------- ### Max Fractional Cadence Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Lap.html Methods to get and set the scaled maximum fractional cadence. ```APIDOC ## pub fn max_fractional_cadence_scaled(&self) -> Option ### Description Returns `max_fractional_cadence` in its scaled value. It returns `None` when value is invalid. ### Units rpm ## pub fn set_max_fractional_cadence_scaled(&mut self, v: f64) -> &mut Self ### Description Set `max_fractional_cadence` with scaled value, it will automatically be converted to its corresponding integer value. ``` -------------------------------- ### Implementing PartialEq for DigitalWatchfaceLayout Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.DigitalWatchfaceLayout.html Enables comparison of DigitalWatchfaceLayout values for equality. This allows checking if two layout values are the same. ```rust fn eq(&self, other: &DigitalWatchfaceLayout) -> bool; ``` ```rust fn ne(&self, other: &Rhs) -> bool; ``` -------------------------------- ### Generic CloneToUninit Implementation Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.WorkoutHr.html An experimental, nightly-only API for cloning data into uninitialized memory. Use with caution as it involves unsafe operations. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) { // 🔬This is a nightly-only experimental API. (`clone_to_uninit`) // Performs copy-assignment from `self` to `dest`. // Read more } ``` -------------------------------- ### Average Fractional Cadence Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Lap.html Methods to get and set the scaled average fractional cadence. ```APIDOC ## pub fn avg_fractional_cadence_scaled(&self) -> Option ### Description Returns `avg_fractional_cadence` in its scaled value. It returns `None` when value is invalid. ### Units rpm ## pub fn set_avg_fractional_cadence_scaled(&mut self, v: f64) -> &mut Self ### Description Set `avg_fractional_cadence` with scaled value, it will automatically be converted to its corresponding integer value. ``` -------------------------------- ### Clone Implementation for ExdDisplayType Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/typedef/struct.ExdDisplayType.html Demonstrates the `clone` and `clone_from` methods for ExdDisplayType, allowing instances to be duplicated. ```rust fn clone(&self) -> ExdDisplayType; ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Average Stance Time Scaled Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.Lap.html Methods to get and set the scaled average stance time. ```APIDOC ## pub fn avg_stance_time_scaled(&self) -> Option ### Description Returns `avg_stance_time` in its scaled value. It returns `None` when value is invalid. ### Units ms ## pub fn set_avg_stance_time_scaled(&mut self, v: f64) -> &mut Self ### Description Set `avg_stance_time` with scaled value, it will automatically be converted to its corresponding integer value. ``` -------------------------------- ### FileCreator Implementations Source: https://docs.rs/rustyfit/0.10.0/rustyfit/profile/mesgdef/struct.FileCreator.html Details on the implementations available for the FileCreator struct, including constants, creation methods, and conversions. ```APIDOC ### impl FileCreator #### pub const SOFTWARE_VERSION: u8 = 0 Value’s type: `u16`; FitBaseType::UINT16; ProfileType::Uint16 #### pub const HARDWARE_VERSION: u8 = 1 Value’s type: `u8`; FitBaseType::UINT8; ProfileType::Uint8 #### pub fn new() -> Self Create new FileCreator with all fields being set to its corresponding invalid value. ```