with_axis

Function with_axis 

Source
pub fn with_axis(
    r: &ResolvedSolveRequestV1,
    axis: InputAxis,
    v: AxisValue,
) -> Result<SolveRequestV1, KernelError>
Expand description

Rebuild r as a solvable SolveRequestV1 with exactly one axis overwritten to v.

Every other input is carried across unchanged via the reverse conversion (request_roundtrip.rs). Writing a requires_rezero axis (see crate::perturbation::axis_meta) while a zero_distance_m is present on the REBUILT request clears the carried effective muzzle_angle_rad, so the next solve re-zeroes at the (possibly just-changed) distance instead of reusing a stale angle – see the module doc for why this is checked after the axis is written, not before.

§Errors

  • KernelError::AxisUnsupportedForRequest if axis is well-formed and present, but this request’s OTHER inputs make perturbing it physically wrong (the two guards in the module doc: Altitude under QNH pressure, ShotAzimuth under compass wind).
  • KernelError::AxisAbsent if axis is structurally unavailable on this request (the three wind axes under segmented wind), mirroring read_axis returning None for the same condition.
  • KernelError::TypeMismatch if v’s kind does not match axis (e.g. a Scalar for DragModel).
  • KernelError::NonFinite if v is a non-finite Scalar.