[][src]Macro uom::system

macro_rules! system {
    (
        $(#[$quantities_attr:meta])* quantities: $quantities:ident {
            $($(#[$name_attr:meta])* $name:ident: $unit:ident, $symbol:ident;)+
        }
        $(#[$units_attr:meta])* units: $units:ident {
            $($module:ident::$quantity:ident,)+
        }
    ) => { ... };
    (
        $(#[$quantities_attr:meta])* quantities: $quantities:ident {
            $($(#[$name_attr:meta])* $name:ident: $unit:ident, $symbol:ident;)+
        }
        $(#[$units_attr:meta])* units: $units:ident {
            $(mod $module:ident::$quantity:ident,)+
        }
    ) => { ... };
    (
        @quantities $path:path,
        $V:ty;
        $($name:ident),+;
        ($($U:ident),+);
        $($module:ident::$quantity:ident),+
    ) => { ... };
    (@replace $_t:tt $sub:ty) => { ... };
}

Macro to implement a system of quantities. @... match arms are considered private.

An example invocation is given below for a meter-kilogram-second system. The #[macro_use] attribute must be used when including the uom crate to make the system! macro available.

#[macro_use]
extern crate uom;

system! {
    /// System of quantities, Q.
    quantities: Q {
        length: meter, L;
        mass: kilogram, M;
        time: second, T;
    }
    /// System of units, U.
    units: U {
        mod length::Length,
        mod mass::Mass,
        mod time::Time,
    }
}