Macros¶
exact_units has a handful of macros. Each one either writes a value that is worked out at compile time or declares a marker of your own. This page lists them all, one line each, with the page that explains it.
Values¶
Each macro here gives a value worked out at compile time, so nothing of it runs on the device.
| Macro | What it gives | Explained in |
|---|---|---|
fixed!(3.3), fixed!(100 m/s) |
A typed constant from a decimal: the stored integer is worked out from the context's unit and scale. | fixed! |
q!(100 m/s), q!(25 degC) |
A decimal with its unit, compared exactly with a Fixed or a Point. Default feature q. |
q!, the symbols of q! |
exact!(8071.31806 keV) |
A decimal with its unit as an Exact of that unit, the prefix folded in exactly; q!(..).to_exact() the same. Default feature q. |
exact! |
db!(-3) |
A gain at a level in decibels, as the stored value nearest to it. | db! |
np!(-1) |
A gain at a level in nepers, as the stored value nearest to it. | Neper |
assert_in!(X, q!(..)) |
A constant checked against a q! range at compile time, X itself where it is in it, else a compile error. |
Checked at compile time |
Declarations¶
Each macro here declares markers of your own, with the same lines WireWeaver reads from source.
| Macro | What it declares | Explained in |
|---|---|---|
unit! { .. } |
Unit markers: a symbol, a dimension and an exact scale per line. | unit! |
scale! { .. } |
Scale markers, the P of a Fixed: a symbol and an exact factor per line. |
scale! |
origin! { .. } |
An origin marker for points: a unit, a symbol and an exact offset. | origin! |
niches! { .. } |
The meanings of a storage's niche codes (not available, error) as an enum. | Declaring codes |
base!(Pixel) |
The MarkerId of a distinguished base, named by your crate and the marker's name. |
Distinguished bases |
The API reference on docs.rs has each macro's full syntax.