Module truing_service

Module truing_service 

Source
Expand description

Transport-free tall-target and dsf derivation services.

§Tall-target

Replicates the CLI’s tall-target arithmetic exactly — same imperial/metric divisor branch, same four validation guards, same tracking-CF band check via crate::profile::validate_tracking_cf — as a versioned request/result pair the bridge can expose to embedded consumers. The CLI’s Commands::TallTarget arm keeps its println! formatting but calls tall_target_v1 for the arithmetic, so the two callers cannot drift apart.

§dsf derivation (MBA-1357 Task 9)

derive_dsf_point_v1 is the model-driven entry point a JSON bridge caller with only a bare crate::truing::TruingModelInputsV1 reaches: it widens the model into crate::truing_dsf::DsfSolveInputs via the existing From impl (no wind, level shot, no offsets, ICAO reference, no BC segments — see that impl’s own doc comment), solves, and derives one Mach-keyed DSF point.

The CLI’s saved-profile dsf command has a richer input than any bare TruingModelInputsV1 can express — wind, shooting angle, zero-POI offsets, sight-mount offset, BC reference, BC segments, a custom drag curve (MBA-1357 Task 8’s DsfSolveInputs, and the two regressions its review caught when that fidelity was first silently narrowed). So the CLI keeps building its own DsfSolveInputs from the loaded profile and solving directly via crate::truing_dsf::solve_for_dsf — unchanged from Task 8 — rather than going through derive_dsf_point_v1’s narrower model. What it DOES share with derive_dsf_point_v1, so the two callers’ arithmetic cannot drift apart, is derive_dsf_point_from_solve_v1: the post-solve derivation (interpolation, Mach computation, both gates, the DSF ratio) factored out of derive_dsf_point_v1 so it can run against a TrajectoryResult from EITHER solve path. derive_dsf_point_v1 is a thin “build inputs, solve, then call the shared derivation” wrapper around it.

Derive only. Neither function ever writes a DSF table, opens a profile, touches the filesystem, or calls std::process::exit — persistence and printing are the CLI’s job.

No feature gate: must compile for wasm32-unknown-unknown. The tall-target half depends only on crate::adjustment and crate::profile; the dsf half depends on crate::truing, crate::truing_dsf, and crate::cli_api::TrajectoryResult, all unconditional and filesystem-free.

Structs§

DialPlanRequestV1
Request for dial_plan_v1: the bridge’s wrapper around plan_corrections’s six flat parameters (MBA-1348 Task 6’s CLI wraps the same six from --elevation/--windage, --profile/inline optic flags, --range, and --prefer-hold/--max-hold).
DsfDeriveRequestV1
Request for a dsf point derivation from a bare scalar-BC model (MBA-1357 Task 9).
DsfPointResultV1
One derived Mach-keyed DSF point, plus any non-fatal warnings the derivation raised.
TallTargetRequestV1
Request for a tall-target correction-factor computation.
TallTargetResultV1
Result of a tall-target correction-factor computation.

Enums§

DsfServiceErrorV1
Errors returned by derive_dsf_point_v1 and derive_dsf_point_from_solve_v1. One variant per failure mode (not a single stringly-typed variant) so a caller — in particular the JSON bridge — can match exhaustively instead of sniffing message text.
TallTargetErrorV1
Errors returned by tall_target_v1. One variant per guard (not a single stringly-typed variant) so a caller — in particular a future JSON bridge — can match exhaustively instead of sniffing message text; adding a fifth guard here forces every match on this type to be updated at compile time.

Functions§

derive_dsf_point_from_solve_v1
The post-solve half of a dsf point derivation: interpolation, Mach computation, both gates, and the DSF ratio, run against an ALREADY-SOLVED result (MBA-1357 Task 9).
derive_dsf_point_v1
Derive a dsf point from a bare scalar-BC model (MBA-1357 Task 9) — the JSON bridge’s entry point, with no saved profile behind it.
dial_plan_v1
Turn a TRUE angular AngularCorrection into ranked dial/hold/hybrid plans for an inline OpticProfile — the JSON bridge’s entry point to plan_corrections.
tall_target_v1
Computes the tall-target correction factor: same arithmetic and validation guards as the CLI’s tall-target command, minus the printing.