Crates.io | unit-proc |
lib.rs | unit-proc |
version | 0.0.3 |
source | src |
created_at | 2022-03-02 13:33:10.544426 |
updated_at | 2022-03-17 15:37:54.646429 |
description | Procedual macros for physical quantities. |
homepage | https://gitlab.com/fton/unit-proc |
repository | https://gitlab.com/fton/unit-proc |
max_upload_size | |
id | 542273 |
size | 22,092 |
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.
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);
This package is in the very early stage.