codata 0.1.1

A lightweight Rust crate providing CODATA 2022 physical and IAU 2015 astronomical constants
Documentation
  • Coverage
  • 64.27%
    786 out of 1223 items documented1 out of 1 items with examples
  • Size
  • Source code size: 207.34 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.46 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ProsiaLAB/codata
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • kmaitreys

codata

A lightweight, no_std Rust crate providing CODATA 2022 physical constants and IAU 2015 astronomical constants.

Usage

Direct Access & Aliases

Familiar symbols are available in the aliases module.

use codata::aliases::{C, G_SI, G_CGS, AU, M_SUN};

fn main() {
    println!("Speed of light: {} m/s", C);
    println!("G (SI):  {}", G_SI);
    println!("G (CGS): {}", G_CGS);
    println!("Solar Mass: {} kg", M_SUN);
}

Dynamic Lookup

Search constants by their official NIST/IAU name.

use codata::find;

fn main() {
    if let Some(c) = find("speed of light in vacuum") {
        println!("Value: {} {}", c.value, c.unit);
    }
}

Unit Conversions

use codata::units::length::LIGHT_YEAR;
use codata::units::time::HOUR;

let dist_m = 5.0 * LIGHT_YEAR;
let duration_s = 2.0 * HOUR;

Data Sources

License

MIT OR Apache-2.0