#engineering #unit-system #hobby #util-lib #string-parser

no-std physical-quantity

dimension and unit system for general physical physical quantities

5 releases

0.0.5 Mar 17, 2022
0.0.4 Mar 13, 2022
0.0.3 Mar 8, 2022
0.0.2 Mar 2, 2022
0.0.1 Mar 1, 2022

#799 in Science

Download history 3/week @ 2024-09-17 33/week @ 2024-09-24

54 downloads per month
Used in 3 crates

MIT/Apache

100KB
2K SLoC

Latest Release pipeline status coverage report

Description

Dimension and unit system for general physical quantities.

This package provids the implementations. For general use, unitage is convenient.

When you use this package only for restrict the argument for your function to paticular dimension, it may be prefer adding this package to the dependencies directly.

Usage

use ::physical_quantity::*;

let inch: Unit<f64, _> = "in.".parse().unwrap();
let pq = inch.pq(1f64);
let mm: Unit<f64, _> = "mm".parse().unwrap();
let inch2mm = mm.value(pq).unwrap();

assert_eq!(inch2mm, 25.4);

Features

This package has the following feature flags. No feature flags are enabled by default.

  • full Enables all features.
  • default-units Enables the default definitions of the units. Enabling this flag enables parser flag also.
  • parser Enables the unit string parser.
  • ratio Enables num_rational::BigRational supports.
  • std Enables std supports.

Project status

This package is in the very early stage.

Dependencies

~0.8–1.6MB
~35K SLoC