1#![allow(clippy::inline_always)]
2
3pub const BUILD_DATE: &str =
6 env!("VERGEN_BUILD_DATE");
7
8pub const COMMIT_SHA: &str =
11 env!("VERGEN_GIT_SHA");
12
13pub const RUSTC_VERSION: &str =
16 env!("VERGEN_RUSTC_SEMVER");
17
18pub const CARGO_TARGET_TRIPLE: &str =
21 env!("VERGEN_CARGO_TARGET_TRIPLE");
22
23pub const SYSTEM_INFO: &str =
26 env!("VERGEN_SYSINFO_OS_VERSION");
27
28#[must_use]
43#[inline(always)]
44
45pub const fn get_build_date()
46-> &'static str {
47
48 BUILD_DATE
49}
50
51#[must_use]
64#[inline(always)]
65
66pub const fn get_commit_sha()
67-> &'static str {
68
69 COMMIT_SHA
70}
71
72#[must_use]
85#[inline(always)]
86
87pub const fn get_rustc_version()
88-> &'static str {
89
90 RUSTC_VERSION
91}
92
93#[must_use]
106#[inline(always)]
107
108pub const fn get_cargo_target_triple()
109-> &'static str {
110
111 CARGO_TARGET_TRIPLE
112}
113
114#[must_use]
127#[inline(always)]
128
129pub const fn get_system_info()
130-> &'static str {
131
132 SYSTEM_INFO
133}
134
135macro_rules! nist_const {
138 ($const_name:ident, $fn_name:ident, $value:expr_2021, $unit:expr_2021, $uncert:expr_2021, $desc:expr_2021) => {
139 #[doc = concat!($desc, "\n\n**Value:** ", stringify!($value), " ", $unit, "\n**Uncertainty:** ", $uncert)]
140 pub const $const_name: f64 = $value;
141
142 #[doc = concat!("Returns the ", $desc)]
143 #[must_use]
144 #[inline(always)]
145 pub const fn $fn_name() -> f64 {
146 $const_name
147 }
148 };
149}
150
151nist_const!(
154 SPEED_OF_LIGHT,
155 get_speed_of_light,
156 299_792_458.0,
157 "m s⁻¹",
158 "exact",
159 "speed of light in vacuum"
160); nist_const!(
163 PLANCK_CONSTANT,
164 get_planck_constant,
165 6.626_070_15e-34,
166 "J Hz⁻¹",
167 "exact",
168 "Planck constant"
169); nist_const!(
172 ELEMENTARY_CHARGE,
173 get_elementary_charge,
174 1.602_176_634e-19,
175 "C",
176 "exact",
177 "elementary charge"
178); nist_const!(
181 BOLTZMANN_CONSTANT,
182 get_boltzmann_constant,
183 1.380_649e-23,
184 "J K⁻¹",
185 "exact",
186 "Boltzmann constant"
187); nist_const!(
190 AVOGADRO_CONSTANT,
191 get_avogadro_constant,
192 6.022_140_76e23,
193 "mol⁻¹",
194 "exact",
195 "Avogadro constant"
196); nist_const!(
201 GRAVITATIONAL_CONSTANT,
202 get_gravitational_constant,
203 6.674_30e-11,
204 "m³ kg⁻¹ s⁻²",
205 "0.00015 x 10⁻¹¹",
206 "Newtonian constant of gravitation"
207); nist_const!(
210 ELECTRON_MASS,
211 get_electron_mass,
212 9.109_383_713_9e-31,
213 "kg",
214 "2.8e-40",
215 "electron mass"
216); nist_const!(
219 FINE_STRUCTURE_CONSTANT,
220 get_fine_structure_constant,
221 7.297_352_564_3e-3,
222 "dimensionless",
223 "0.000_000_001_1e-3",
224 "fine-structure constant"
225); nist_const!(
228 RYDBERG_CONSTANT,
229 get_rydberg_constant,
230 10_973_731.568_157,
231 "m⁻¹",
232 "0.000_000_012",
233 "Rydberg constant"
234); nist_const!(
237 VACUUM_ELECTRIC_PERMITTIVITY,
238 get_vacuum_electric_permittivity,
239 8.854_187_818_8e-12,
240 "F m⁻¹",
241 "0.000_000_001_4e-12",
242 "vacuum electric permittivity"
243); nist_const!(
248 VACUUM_MAGNETIC_PERMEABILITY,
249 get_vacuum_magnetic_permeability,
250 1.256_637_061_27e-6,
251 "N A⁻²",
252 "0.000_000_000_20e-6",
253 "vacuum magnetic permeability"
254); nist_const!(
257 JOSEPHSON_CONSTANT,
258 get_josephson_constant,
259 483_597.848_4e9,
260 "Hz V⁻¹",
261 "exact (definition based)",
262 "Josephson constant (2e/h)"
263); nist_const!(
266 VON_KLITZING_CONSTANT,
267 get_von_klitzing_constant,
268 25_812.807_45,
269 "Ω",
270 "exact (definition based)",
271 "von Klitzing constant (h/e²)"
272); nist_const!(
275 MAGNETIC_FLUX_QUANTUM,
276 get_magnetic_flux_quantum,
277 2.067_833_848e-15,
278 "Wb",
279 "exact (definition based)",
280 "magnetic flux quantum (h/2e)"
281); nist_const!(
286 PROTON_MASS_KG,
287 get_proton_mass_kg,
288 1.672_621_925_95e-27,
289 "kg",
290 "0.000_000_000_52e-27",
291 "proton mass"
292); nist_const!(
295 NEUTRON_MASS_U,
296 get_neutron_mass_u,
297 1.008_664_916_06,
298 "u",
299 "0.000_000_000_40",
300 "neutron mass in atomic mass units"
301); nist_const!(
304 ATOMIC_MASS_CONSTANT,
305 get_atomic_mass_constant,
306 1.660_539_068_92e-27,
307 "kg",
308 "0.000_000_000_52e-27",
309 "atomic mass constant (m_u)"
310); nist_const!(
313 PROTON_ELECTRON_MASS_RATIO,
314 get_proton_electron_mass_ratio,
315 1_836.152_673_426,
316 "dimensionless",
317 "0.000_000_032",
318 "proton-electron mass ratio"
319); nist_const!(
324 BOHR_MAGNETON,
325 get_bohr_magneton,
326 9.274_010_065_7e-24,
327 "J T⁻¹",
328 "0.000_000_002_9e-24",
329 "Bohr magneton"
330); nist_const!(
333 NUCLEAR_MAGNETON,
334 get_nuclear_magneton,
335 5.050_783_739_3e-27,
336 "J T⁻¹",
337 "0.000_000_001_6e-27",
338 "nuclear magneton"
339); nist_const!(
342 ELECTRON_G_FACTOR,
343 get_electron_g_factor,
344 -2.002_319_304_360_92,
345 "dimensionless",
346 "0.000_000_000_000_36",
347 "electron g-factor"
348); nist_const!(
353 MOLAR_GAS_CONSTANT,
354 get_molar_gas_constant,
355 8.314_462_618,
356 "J mol⁻¹ K⁻¹",
357 "exact (defined by R = Na * k)",
358 "molar gas constant"
359); nist_const!(
362 FARADAY_CONSTANT,
363 get_faraday_constant,
364 96_485.332_12,
365 "C mol⁻¹",
366 "exact (defined by F = Na * e)",
367 "Faraday constant"
368); nist_const!(
371 STEFAN_BOLTZMANN_CONSTANT,
372 get_stefan_boltzmann_constant,
373 5.670_374_419e-8,
374 "W m⁻² K⁻⁴",
375 "exact (calculated from k, h, c)",
376 "Stefan-Boltzmann constant"
377); nist_const!(
382 REDUCED_PLANCK_CONSTANT,
383 get_reduced_planck_constant,
384 1.054_571_817e-34,
385 "J s",
386 "uncertainty in source",
387 "reduced Planck constant (h-bar)"
388); nist_const!(
391 INVERSE_FINE_STRUCTURE_CONSTANT,
392 get_inverse_fine_structure_constant,
393 137.035_999_177,
394 "dimensionless",
395 "0.000_000_021",
396 "inverse fine-structure constant \
397 (1/α)"
398); nist_const!(
401 BOHR_RADIUS,
402 get_bohr_radius,
403 5.291_772_105_44e-11,
404 "m",
405 "0.000_000_000_82e-11",
406 "Bohr radius (a₀)"
407); nist_const!(
410 HARTREE_ENERGY,
411 get_hartree_energy,
412 4.359_744_722_206_0e-18,
413 "J",
414 "0.000_000_000_004_8e-18",
415 "Hartree energy (Eh)"
416); nist_const!(
421 ELECTRON_MASS_U,
422 get_electron_mass_u,
423 5.485_799_090_441e-4,
424 "u",
425 "0.000_000_000_097e-4",
426 "electron mass in atomic mass \
427 units"
428); nist_const!(
431 PROTON_MASS_U,
432 get_proton_mass_u,
433 1.007_276_466_578_9,
434 "u",
435 "0.000_000_000_008_3",
436 "proton mass in atomic mass units"
437); nist_const!(
440 DEUTERON_MASS_U,
441 get_deuteron_mass_u,
442 2.013_553_212_544,
443 "u",
444 "0.000_000_000_015",
445 "deuteron mass in atomic mass \
446 units"
447); nist_const!(
450 ALPHA_PARTICLE_MASS_U,
451 get_alpha_particle_mass_u,
452 4.001_506_179_129,
453 "u",
454 "0.000_000_000_062",
455 "alpha particle mass in atomic \
456 mass units"
457); nist_const!(
462 CLASSICAL_ELECTRON_RADIUS,
463 get_classical_electron_radius,
464 2.817_940_320_5e-15,
465 "m",
466 "0.000_000_001_3e-15",
467 "classical electron radius"
468); nist_const!(
471 THOMSON_CROSS_SECTION,
472 get_thomson_cross_section,
473 6.652_458_705_1e-29,
474 "m²",
475 "0.000_000_006_2e-29",
476 "Thomson cross section"
477); nist_const!(
482 WIEN_DISPLACEMENT_CONSTANT,
483 get_wien_displacement_constant,
484 2.897_771_955e-3,
485 "m K",
486 "exact (calculated)",
487 "Wien displacement law constant \
488 (b)"
489); nist_const!(
492 FIRST_RADIATION_CONSTANT,
493 get_first_radiation_constant,
494 3.741_771_852e-16,
495 "W m²",
496 "exact (calculated)",
497 "first radiation constant (c₁)"
498); nist_const!(
501 SECOND_RADIATION_CONSTANT,
502 get_second_radiation_constant,
503 1.438_776_877e-2,
504 "m K",
505 "exact (calculated)",
506 "second radiation constant (c₂)"
507); nist_const!(
511 MUON_G_FACTOR,
512 get_muon_g_factor,
513 -2.002_331_841_23,
514 "dimensionless",
515 "0.000_000_000_82",
516 "muon g-factor"
517); nist_const!(
520 MUON_MASS_U,
521 get_muon_mass_u,
522 0.113_428_925_7,
523 "u",
524 "0.000_000_002_5",
525 "muon mass in atomic mass units"
526); nist_const!(
529 MUON_ELECTRON_MASS_RATIO,
530 get_muon_electron_mass_ratio,
531 206.768_282_7,
532 "dimensionless",
533 "0.000_004_6",
534 "muon-electron mass ratio"
535); nist_const!(
539 PROTON_MAGNETIC_MOMENT,
540 get_proton_magnetic_moment,
541 1.410_606_795_45e-26,
542 "J T⁻¹",
543 "0.000_000_000_60e-26",
544 "proton magnetic moment"
545); nist_const!(
548 NEUTRON_MAGNETIC_MOMENT,
549 get_neutron_magnetic_moment,
550 -9.662_365_3e-27,
551 "J T⁻¹",
552 "0.000_002_3e-27",
553 "neutron magnetic moment"
554); nist_const!(
557 PROTON_MAGNETIC_SHIELDING_CORRECTION, get_proton_magnetic_shielding_correction,
558 2.567_15e-5, "dimensionless", "0.000_41e-5",
559 "proton magnetic shielding correction (H2O sphere, 25°C)"
560); nist_const!(
563 SHIELDED_PROTON_GYROMAGNETIC_RATIO, get_shielded_proton_gyromagnetic_ratio,
564 2.675_153_194e8, "s⁻¹ T⁻¹", "0.000_000_011e8",
565 "shielded proton gyromagnetic ratio (H2O, sphere, 25°C)"
566); nist_const!(
570 NEUTRON_PROTON_MASS_RATIO,
571 get_neutron_proton_mass_ratio,
572 1.001_378_419_46,
573 "dimensionless",
574 "0.000_000_000_40",
575 "neutron-proton mass ratio"
576); nist_const!(
579 ELECTRON_MUON_MASS_RATIO,
580 get_electron_muon_mass_ratio,
581 4.836_331_70e-3,
582 "dimensionless",
583 "0.000_000_11e-3",
584 "electron-muon mass ratio"
585); nist_const!(
588 DEUTERON_PROTON_MASS_RATIO,
589 get_deuteron_proton_mass_ratio,
590 1.999_007_501_269_9,
591 "dimensionless",
592 "0.000_000_000_008_4",
593 "deuteron-proton mass ratio"
594); nist_const!(
597 ELECTRON_CHARGE_TO_MASS_QUOTIENT, get_electron_charge_to_mass_quotient,
598 -1.758_820_008_38e11, "C kg⁻¹", "0.000_000_000_55e11",
599 "electron charge to mass quotient"
600); nist_const!(
604 MOLAR_VOLUME_IDEAL_GAS,
605 get_molar_volume_ideal_gas,
606 22.413_969_54e-3,
607 "m³ mol⁻¹",
608 "exact (at 273.15 K, 101.325 kPa)",
609 "molar volume of ideal gas"
610); nist_const!(
613 MUON_MAGNETIC_MOMENT,
614 get_muon_magnetic_moment,
615 -4.490_448_30e-26,
616 "J T⁻¹",
617 "0.000_000_10e-26",
618 "muon magnetic moment"
619);