Skip to main content

parse_wind_segment_str

Function parse_wind_segment_str 

Source
pub fn parse_wind_segment_str(
    s: &str,
    imperial: bool,
) -> Result<WindSegment, String>
Expand description

Parse a "SPEED:ANGLE:UNTIL_DISTANCE" string into a WindSegment (speed_kmh, angle_deg, until_distance_m).

imperial: when true, SPEED is mph and UNTIL_DISTANCE is yards; otherwise SPEED is m/s and UNTIL_DISTANCE is meters. ANGLE is always degrees in the wind-FROM convention (0 = headwind, 90 = from the right). Shared by the CLI (--wind-segment) and the WASM front-ends so they parse identically.