qtty-derive
Derive macro used by qtty-core to implement new unit marker types.
Most applications should depend on the qtty facade. Reach for qtty-derive only if you are extending the unit
catalogue yourself or building a crate that mirrors the qtty crate root (Quantity, Unit, …).
Install
[]
= "0.1.0"
= "0.1.0"
Usage
use ;
use Unit as UnitDerive;
;
let dist: = new;
assert!;
The derive generates both the Unit impl (ratio, dimension tag, and symbol) and a Display implementation for
Quantity<Furlong> that prints <value> <symbol>.
Attribute reference
The macro reads a required #[unit(...)] attribute with the following keys:
symbol = "m": string literal printed by the generatedDisplayimpl.dimension = Length: dimension marker type implementingDimension.ratio = 1.0: conversion ratio to the canonical unit of the dimension (usually 1.0 for the base unit).
Additional metadata can be added in the future without breaking callers (unknown keys result in a compile error).
License
AGPL-3.0 (see ../LICENSE).