Module card_service

Module card_service 

Source
Expand description

Transport-free card-generation services (come-ups, range table, wind card).

These replicate the CLI’s card commands exactly — same zero solve, same sampled trajectory, same nearest-sample row selection, same adjustment/bias/CF/click ordering via crate::adjustment — as versioned request/response types the bridge can expose to embedded consumers. The CLI remains the reference implementation; tests/card_bridge_golden.rs asserts row-for-row agreement.

§Unit convention

Unlike solve-json (explicit SI), card requests are denominated in the declared units system, exactly like the CLI flags they mirror: imperial = fps, grains, inches, yards, °F, inHg, mph; metric = m/s, grams, mm, meters, °C, hPa, m/s. A DOPE card is a display artifact; its inputs and outputs share the shooter’s unit world, and this keeps the request shape identical to the documented CLI surface.

Structs§

CardBcSegmentV1
One velocity band of an explicit velocity-keyed BC schedule (CardRequestV1::bc_segments). velocity_min/velocity_max are in the request’s units velocity unit and must satisfy velocity_min < velocity_max; bc is the BC (for the request’s drag_model) that applies inside the band.
CardRequestV1
Everything the three card surfaces share: load, zero, atmosphere, display axes. Field values are in the units system (see module docs).
CardResponseV1
CardRowV1
CardUnitsBlockV1
PdfCardOptionsV1
Presentation knobs for the PDF dope card: the header/footer labels the printed card carries and the table’s font size. The ballistics axes it prints (elevation unit, windage unit, click graduations, tracking CFs, zero-set biases) are NOT here — they are already fields on CardRequestV1, shared with the on-screen card, precisely so the two cannot disagree about what a row means.
PdfCardV1
A rendered PDF dope card: the document plus the facts a transport needs to describe it without re-parsing the bytes.
StoredCardResponseV1
A stored CardResponseV1, as a deserializable mirror.
StoredCardRowV1
One stored row (see CardRowV1, which this mirrors). Only range is required; a column the stored card did not carry stays None and prints as an em-dash rather than a fabricated zero. Unknown fields are ignored, for the reason StoredCardResponseV1 gives.
StoredCardUnitsBlockV1
The units block of a stored response (see CardUnitsBlockV1, which this mirrors). Unknown fields are ignored, for the reason StoredCardResponseV1 gives.
StoredCardV1
A card whose rows already exist: print THESE numbers instead of solving.

Enums§

CardServiceError
CardUnits
DragModelV1
Drag model selector mirroring the CLI’s --drag-model strings.
PdfRowSource
Where the printed rows came from — reported so a caller can verify it got a reprint rather than a re-solve, which is otherwise indistinguishable from the document.

Constants§

CARD_SCHEMA_VERSION_V1
Schema version of the card request/response contract.
MAX_PDF_PAGES
Pages a printable card may run to. Bounds the one row set the row cap above cannot: few enough rows, but at a font scale that fits very few of them per page.
MAX_PDF_ROWS
Rows a printable card may carry.
PDF_CARD_KIND
The one card kind card.pdf can print, in the kind spelling CardResponseV1::kind uses.

Functions§

come_ups_v1
Come-ups: elevation dial per range plus the incremental come-up between rows. Mirrors the CLI’s come-ups command row-for-row.
pdf_card_v1
Render the printable PDF dope card for a card request.
range_table_v1
Range table: drop and wind on possibly different display axes. Mirrors the CLI’s range-table command row-for-row (two solves: with wind for drift, without wind for the pure elevation axis).
wind_card_v1
Wind card: drift matrix, ranges x wind speeds, per wind-FROM angle. Mirrors the CLI’s wind-card command cell-for-cell. The windage axis uses adjustment_unit (the CLI’s wind-card has a single unit for the matrix).