#[macro_use]
mod prefix;
system! {
quantities: ISQ {
length: meter, L;
mass: kilogram, M;
time: second, T;
electric_current: ampere, I;
thermodynamic_temperature: kelvin, Th;
amount_of_substance: mole, N;
luminous_intensity: candela, J;
}
units: SI {
acceleration::Acceleration,
amount_of_substance::AmountOfSubstance,
angle::Angle,
angular_acceleration::AngularAcceleration,
angular_velocity::AngularVelocity,
area::Area,
available_energy::AvailableEnergy,
capacitance::Capacitance,
electric_charge::ElectricCharge,
electric_current::ElectricCurrent,
electric_potential::ElectricPotential,
electrical_conductance::ElectricalConductance,
electrical_resistance::ElectricalResistance,
energy::Energy,
force::Force,
frequency::Frequency,
inductance::Inductance,
jerk::Jerk,
length::Length,
luminance::Luminance,
luminous_intensity::LuminousIntensity,
magnetic_flux::MagneticFlux,
magnetic_flux_density::MagneticFluxDensity,
mass::Mass,
mass_density::MassDensity,
mass_rate::MassRate,
momentum::Momentum,
power::Power,
pressure::Pressure,
ratio::Ratio,
temperature_interval::TemperatureInterval,
thermodynamic_temperature::ThermodynamicTemperature,
time::Time,
torque::Torque,
velocity::Velocity,
volume::Volume,
volume_rate::VolumeRate,
}
}
pub mod quantities {
ISQ!(si);
}
storage_types! {
pub types: All;
ISQ!(si, V);
}
pub mod marker {
use si::{Dimension, Quantity, Units};
use Kind;
#[cfg_attr(feature = "f32", doc = " ```rust")]
#[cfg_attr(not(feature = "f32"), doc = " ```rust,ignore")]
pub trait AngleKind: ::Kind {}
pub trait TemperatureKind:
::marker::Mul
+ ::marker::MulAssign
+ ::marker::Div
+ ::marker::DivAssign
+ ::marker::Rem
+ ::marker::RemAssign
{
}
#[cfg(feature = "autoconvert")]
#[macro_export]
macro_rules! impl_from {
($a:ident, $b:ident) => {
impl<L, M, T, I, Th, N, J, Ul, Ur, V>
From<
Quantity<
Dimension<L = L, M = M, T = T, I = I, Th = Th, N = N, J = J, Kind = $a>,
Ur,
V,
>,
>
for Quantity<
Dimension<L = L, M = M, T = T, I = I, Th = Th, N = N, J = J, Kind = $b>,
Ul,
V,
>
where
Ul: Units<V> + ?Sized,
Ur: Units<V> + ?Sized,
V: ::num_traits::Num + ::Conversion<V>,
{
fn from(
val: Quantity<
Dimension<L = L, M = M, T = T, I = I, Th = Th, N = N, J = J, Kind = $a>,
Ur,
V,
>,
) -> Quantity<
Dimension<L = L, M = M, T = T, I = I, Th = Th, N = N, J = J, Kind = $b>,
Ul,
V,
> {
Self {
dimension: ::lib::marker::PhantomData,
units: ::lib::marker::PhantomData,
value: super::change_base::<
Dimension<L = L, M = M, T = T, I = I, Th = Th, N = N, J = J, Kind = $b>,
Ul,
Ur,
V,
>(&val.value),
}
}
}
};
}
#[cfg(not(feature = "autoconvert"))]
#[macro_export]
macro_rules! impl_from {
($a:ident, $b:ident) => {
impl<L, M, T, I, Th, N, J, U, V>
From<
Quantity<
Dimension<L = L, M = M, T = T, I = I, Th = Th, N = N, J = J, Kind = $a>,
U,
V,
>,
>
for Quantity<
Dimension<L = L, M = M, T = T, I = I, Th = Th, N = N, J = J, Kind = $b>,
U,
V,
>
where
U: Units<V> + ?Sized,
V: ::num_traits::Num + ::Conversion<V>,
{
fn from(
val: Quantity<
Dimension<L = L, M = M, T = T, I = I, Th = Th, N = N, J = J, Kind = $a>,
U,
V,
>,
) -> Quantity<
Dimension<L = L, M = M, T = T, I = I, Th = Th, N = N, J = J, Kind = $b>,
U,
V,
> {
Self {
dimension: ::lib::marker::PhantomData,
units: ::lib::marker::PhantomData,
value: val.value,
}
}
}
};
}
impl_from!(AngleKind, Kind);
impl_from!(Kind, AngleKind);
}