Skip to content

Commit

Permalink
Merge 4f28643 into 14c8269
Browse files Browse the repository at this point in the history
  • Loading branch information
iliekturtles committed May 5, 2019
2 parents 14c8269 + 4f28643 commit facd41b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
14 changes: 14 additions & 0 deletions src/si/mod.rs
Expand Up @@ -10,12 +10,26 @@ mod prefix;
system! {
/// [International System of Quantities](http://jcgm.bipm.org/vim/en/1.6.html) (ISQ).
quantities: ISQ {
/// Length, one of the base quantities in the ISQ, denoted by the symbol L. The base unit
/// for length is meter in the SI.
length: meter, L;
/// Mass, one of the base quantities in the ISQ, denoted by the symbol M. The base unit
/// for mass is kilogram in the SI.
mass: kilogram, M;
/// Time, one of the base quantities in the ISQ, denoted by the symbol T. The base unit
/// for time is second in the SI.
time: second, T;
/// Electric current, one of the base quantities in the ISQ, denoted by the symbol I. The
/// base unit for electric current is ampere in the SI.
electric_current: ampere, I;
/// Thermodynamic temperature, one of the base quantities in the ISQ, denoted by the symbol
/// Th (Θ). The base unit for thermodynamic temperature is kelvin in the SI.
thermodynamic_temperature: kelvin, Th;
/// Amount of substance, one of the base quantities in the ISQ, denoted by the symbol N.
/// The base unit for amount of substance is mole in the SI.
amount_of_substance: mole, N;
/// Luminous intensity, one of the base quantities in the ISQ, denoted by the symbol J. The
/// base unit for luminous intensity is candela in the SI.
luminous_intensity: candela, J;
}

Expand Down
16 changes: 11 additions & 5 deletions src/system.rs
Expand Up @@ -4,6 +4,8 @@
/// * `$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_attr`: Base quantity attributes. Generally used to set documentation comments for base
/// units.
/// * `$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`).
Expand Down Expand Up @@ -85,7 +87,7 @@
macro_rules! system {
(
$(#[$quantities_attr:meta])* quantities: $quantities:ident {
$($name:ident: $unit:ident, $symbol:ident;)+
$($(#[$name_attr:meta])* $name:ident: $unit:ident, $symbol:ident;)+
}
$(#[$units_attr:meta])* units: $units:ident {
$($module:ident::$quantity:ident,)+
Expand All @@ -97,7 +99,7 @@ macro_rules! system {
system! {
$(#[$quantities_attr])*
quantities: $quantities {
$($name: $unit, $symbol;)+
$($(#[$name_attr])* $name: $unit, $symbol;)+
}
$(#[$units_attr])*
units: $units {
Expand All @@ -107,7 +109,7 @@ macro_rules! system {
};
(
$(#[$quantities_attr:meta])* quantities: $quantities:ident {
$($name:ident: $unit:ident, $symbol:ident;)+
$($(#[$name_attr:meta])* $name:ident: $unit:ident, $symbol:ident;)+
}
$(#[$units_attr:meta])* units: $units:ident {
$(mod $module:ident::$quantity:ident,)+
Expand All @@ -123,7 +125,9 @@ macro_rules! system {
/// [base]: http://jcgm.bipm.org/vim/en/1.4.html
/// [quantities]: http://jcgm.bipm.org/vim/en/1.3.html
pub trait Dimension: Send + Sync {
$(/// Quantity dimension.
$($(#[$name_attr])*
///
/// Quantity dimension.
type $symbol: $crate::typenum::Integer;)+

/// [Kind][kind] of the quantity. Quantities of the same dimension but differing kinds
Expand All @@ -143,7 +147,9 @@ macro_rules! system {
where
V: $crate::Conversion<V>,
{
$(/// Base unit.
$($(#[$name_attr])*
///
/// Base unit.
type $name: Unit + $crate::Conversion<V, T = V::T>;)+
}

Expand Down

0 comments on commit facd41b

Please sign in to comment.