#hobby #util-lib #procedual-macro

macro unit-proc

Procedual macros for physical quantities

3 releases

0.0.3 Mar 17, 2022
0.0.2 Mar 13, 2022
0.0.1 Mar 2, 2022

#7 in #util-lib

23 downloads per month
Used in unitage

MIT/Apache

11KB
217 lines

Latest Release pipeline status coverage report

Description

Procedural macro for generate struct Unit in compile time.

This package is the implementation of the procedural macro. For use these macros in your code, unitage is convenient.

Usage

extern crate typenum;

use unit_proc::unit;
use const_frac::Frac;
use physical_quantity:: { Unit, Dim };
use typenum;

let height = unit!("ft.").pq(5f64) + unit!("in.").pq(8f64);
let cm = unit!("cm").value(height);

assert_eq!(cm, 172.72);

Project status

This package is in the very early stage.

Dependencies

~2.5MB
~61K SLoC