Skip to main content

InputData

Struct InputData 

Source
pub struct InputData {
Show 32 fields pub ball_speed_meters_per_second: Option<f64>, pub ball_speed_mph: Option<f64>, pub vertical_launch_angle_degrees: Option<f64>, pub horizontal_launch_angle_degrees: Option<f64>, pub total_spin_rpm: Option<f64>, pub spin_axis_degrees: Option<f64>, pub backspin_rpm: Option<f64>, pub sidespin_rpm: Option<f64>, pub club_speed_meters_per_second: Option<f64>, pub club_speed_mph: Option<f64>, pub carry_distance_yards: Option<f64>, pub total_distance_yards: Option<f64>, pub offline_distance_yards: Option<f64>, pub peak_height_yards: Option<f64>, pub landing_position_yards: Option<Vector3>, pub landing_velocity_mph: Option<Vector3>, pub landing_position: Option<Vector3>, pub landing_velocity: Option<Vector3>, pub carry_distance_meters: Option<f64>, pub total_distance_meters: Option<f64>, pub offline_distance_meters: Option<f64>, pub descent_angle_degrees: Option<f64>, pub hang_time_seconds: Option<f64>, pub peak_height_meters: Option<f64>, pub smash_factor: Option<f64>, pub pressure_pascals: Option<f64>, pub elevation_meters: Option<f64>, pub temperature_kelvin: Option<f64>, pub humidity_percent: Option<f64>, pub us_customary_units: Option<InputUSCustomaryUnits>, pub trajectory_enabled: Option<bool>, pub trajectory_output_framerate_hz: Option<f64>,
}
Expand description

Input data structure for reading values from JSON.

Fields are public and Default::default() returns an all-None instance, so Rust callers can construct an InputData directly without going through JSON:

use opengolfcoach::{calculate_derived_values_from_input, InputData};

let input = InputData {
    ball_speed_meters_per_second: Some(70.0),
    vertical_launch_angle_degrees: Some(12.5),
    trajectory_enabled: Some(true),
    ..Default::default()
};
let derived = calculate_derived_values_from_input(&input);

Fields§

§ball_speed_meters_per_second: Option<f64>§ball_speed_mph: Option<f64>§vertical_launch_angle_degrees: Option<f64>§horizontal_launch_angle_degrees: Option<f64>§total_spin_rpm: Option<f64>§spin_axis_degrees: Option<f64>§backspin_rpm: Option<f64>§sidespin_rpm: Option<f64>§club_speed_meters_per_second: Option<f64>§club_speed_mph: Option<f64>§carry_distance_yards: Option<f64>§total_distance_yards: Option<f64>§offline_distance_yards: Option<f64>§peak_height_yards: Option<f64>§landing_position_yards: Option<Vector3>§landing_velocity_mph: Option<Vector3>§landing_position: Option<Vector3>§landing_velocity: Option<Vector3>§carry_distance_meters: Option<f64>§total_distance_meters: Option<f64>§offline_distance_meters: Option<f64>§descent_angle_degrees: Option<f64>§hang_time_seconds: Option<f64>§peak_height_meters: Option<f64>§smash_factor: Option<f64>§pressure_pascals: Option<f64>§elevation_meters: Option<f64>§temperature_kelvin: Option<f64>§humidity_percent: Option<f64>§us_customary_units: Option<InputUSCustomaryUnits>§trajectory_enabled: Option<bool>

Opt in to receiving the simulated ball trajectory under open_golf_coach.trajectory. Default false.

§trajectory_output_framerate_hz: Option<f64>

Down-sample rate for the emitted trajectory, in Hz. Clamped to (0, 500]. If trajectory_enabled is true and this is None or <= 0.0, the native simulation rate (500 Hz) is used.

Trait Implementations§

Source§

impl Clone for InputData

Source§

fn clone(&self) -> InputData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InputData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InputData

Source§

fn default() -> InputData

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for InputData

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,