Expand description
Derive macro implementation used by qtty-core.
qtty-derive is an implementation detail of this workspace. The Unit derive expands in terms of crate::Unit
and crate::Quantity, so it is intended to be used by qtty-core (or by crates that expose an identical
crate-root API).
Most users should depend on qtty instead and use the predefined units.
§Generated impls
For a unit marker type MyUnit, the derive implements:
crate::Unit for MyUnitcore::fmt::Display for crate::Quantity<MyUnit>(formats as<value> <symbol>)
§Attributes
The derive reads a required #[unit(...)] attribute:
symbol = "m": displayed unit symboldimension = SomeDim: dimension marker typeratio = 1000.0: conversion ratio to the canonical unit of the dimension
Derive Macros§
- Unit
- Derive
crate::Unitand aDisplayimpl forcrate::Quantity<ThisUnit>.