Macro uom::system
[−]
[src]
macro_rules! system { ( $(#[$quantities_attr:meta])* quantities: $quantities:ident { $($name:ident: $unit:ident, $symbol:ident;)+ } $(#[$units_attr:meta])* units: $units:ident { $($module:ident::$quantity:ident,)+ } ) => { ... }; ( $(#[$quantities_attr:meta])* quantities: $quantities:ident { $($name:ident: $unit:ident, $symbol:ident;)+ } $(#[$units_attr:meta])* units: $units:ident { $($quantity:ident,)+ } ) => { ... }; }
Macro to implement a system of quantities.
$quantities_attr
: System of quantities attributes. Generally used to set documentation comments for the system of quantities.$quantities
: Name of the system of quantities (e.g.ISQ
).$name
: Name of the base quantities for the system of quantities (e.g.length
,mass
, ...). Note that this name must match the module name of the quantity.$unit
: Base unit of the quantity (e.g.meter
,kilogram
).$symbol
: Dimension symbol of the quantity.$units_attr
: System of units attributes. Generally used to set documentation comments for the system of units.$units
: Name of the system of units (e.g.SI
).$module
: Optional. Module name of the quantity. A#[macro_use] pub mod $module;
statement is generated if this variable is given.$quantity
: Quantity name (e.g.Length
,Mass
, ...).
An example invocation is given below for a meter-kilogram-second system.
system! { /// System of quantities, Q. quantities: Q { length: meter, L; mass: kilogram, M; time: second, T; } /// System of units, U. units: U { mks_Length, mks_Mass, mks_Time, } }