hpr_core/tool.rs
1//! The program every file and document hpr-sim writes names, as a drawing's title block names
2//! the tool that made it: its name, its version and its designation in the FusionSpace product
3//! system ([ADR-164][adr-164], which adopts that system; its `data.md`: "Every export carries the
4//! designation and version of the tool that made it").
5//!
6//! [adr-164]: https://github.com/nrdptel/hpr-sim/blob/main/docs/decisions/0164-the-fusionspace-product-system.md
7//!
8//! The writers put these three in whatever place their format keeps for it: a `.eng` file's
9//! comment, an XML comment or attribute, a JSON object, Parquet's key-value metadata.
10
11/// The program's name: `hpr-sim`.
12pub const NAME: &str = "hpr-sim";
13
14/// Its version, the workspace's: `0.1.0` until the first release changes it.
15pub const VERSION: &str = env!("CARGO_PKG_VERSION");
16
17/// Its designation in the FusionSpace product system, `<code> · <tag> · <kind> <number>` in the
18/// system's grammar: software tool 5.
19pub const DESIGNATION: &str = "FS · SW · TOOL 005";
20
21/// The three on one line, `hpr-sim 0.1.0 · FS · SW · TOOL 005`, for a format that keeps one
22/// line of text for it.
23pub fn stamp() -> String {
24 format!("{NAME} {VERSION} · {DESIGNATION}")
25}
26
27#[cfg(test)]
28mod tests {
29 use super::*;
30
31 /// The line names all three, in the order a title block reads.
32 #[test]
33 fn the_stamp_reads_name_version_designation() {
34 assert_eq!(
35 stamp(),
36 format!("hpr-sim {} · FS · SW · TOOL 005", env!("CARGO_PKG_VERSION"))
37 );
38 }
39}