Change Meter to Metre

This commit is contained in:
Max Känner 2023-03-04 17:56:52 +01:00
parent 44ff54160c
commit fa40445683
4 changed files with 233 additions and 243 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "units"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
description = "Si units for typesafe calculations"
license = "MIT or Apache-2.0"
@ -13,7 +13,7 @@ categories = ["Science", "Simulation"]
[dependencies]
typenum = "1.16"
num-traits = {version = "0.2", default-features = false}
num-traits = { version = "0.2", default-features = false }
defmt = { version = "0.3", optional = true }
[features]

View File

@ -1,19 +1,16 @@
#[cfg(not(feature = "std"))]
use core::fmt::{self, Display, Formatter};
#[cfg(feature = "std")]
use std::fmt::{self, Display, Formatter};
use typenum::Integer;
use crate::{
types::{
AmperePerMeter, AmperePerSquareMeter, Coulomb, CoulombPerCubicMeter, CoulombPerKilogram,
CoulombPerSquareMeter, CubicMeterPerKilogram, Farad, FaradPerMeter, Gray, GrayPerSecond,
Henry, HenryPerMeter, Herz, Joule, JoulePerKelvin, JoulePerKilogramKelvin, JoulePerMole,
JoulePerMoleKelvin, Katal, KatalPerCubicMeter, KilogramPerCubicMeter,
KilogramPerSquareMeter, Lux, MeterPerSecond, MeterPerSquareSecond, MolePerCubicMeter,
Newton, NewtonPerMeter, Ohm, Pascal, PascalSecond, Siemens, Tesla, Volt, VoltPerMeter,
Watt, WattPerMeterKelvin, WattPerSquareMeter, Weber,
AmperePerMetre, AmperePerSquareMetre, Coulomb, CoulombPerCubicMetre, CoulombPerKilogram,
CoulombPerSquareMetre, CubicMetrePerKilogram, Farad, FaradPerMetre, Gray, GrayPerSecond,
Henry, HenryPerMetre, Herz, Joule, JoulePerKelvin, JoulePerKilogramKelvin, JoulePerMole,
JoulePerMoleKelvin, Katal, KatalPerCubicMetre, KilogramPerCubicMetre,
KilogramPerSquareMetre, Lux, MetrePerSecond, MetrePerSquareSecond, MolePerCubicMetre,
Newton, NewtonPerMetre, Ohm, Pascal, PascalSecond, Siemens, Tesla, Volt, VoltPerMetre,
Watt, WattPerMetreKelvin, WattPerSquareMetre, Weber,
},
SiUnit,
};
@ -53,11 +50,11 @@ macro_rules! display_special_unit_defmt {
}
#[cfg(feature = "defmt")]
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> defmt::Format
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> defmt::Format
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -89,43 +86,43 @@ where
);
// derived units
display_special_unit_defmt!(f, Self,
("m/s", MeterPerSecond<T>),
("m/s²", MeterPerSquareSecond<T>),
("kg/m³", KilogramPerCubicMeter<T>),
("kg/m²", KilogramPerSquareMeter<T>),
("m³/kg", CubicMeterPerKilogram<T>),
("A/m²", AmperePerSquareMeter<T>),
("A/m", AmperePerMeter<T>),
("mol/m³", MolePerCubicMeter<T>),
("m/s", MetrePerSecond<T>),
("m/s²", MetrePerSquareSecond<T>),
("kg/m³", KilogramPerCubicMetre<T>),
("kg/m²", KilogramPerSquareMetre<T>),
("m³/kg", CubicMetrePerKilogram<T>),
("A/m²", AmperePerSquareMetre<T>),
("A/m", AmperePerMetre<T>),
("mol/m³", MolePerCubicMetre<T>),
);
// derived units including special names
display_special_unit_defmt!(f, Self,
("Pa*s", PascalSecond<T>),
("N/m", NewtonPerMeter<T>),
("W/m²", WattPerSquareMeter<T>),
("N/m", NewtonPerMetre<T>),
("W/m²", WattPerSquareMetre<T>),
("J/K", JoulePerKelvin<T>),
("J/(kg*K)", JoulePerKilogramKelvin<T>),
("W/(m*K)", WattPerMeterKelvin<T>),
("V/m", VoltPerMeter<T>),
("C/m³", CoulombPerCubicMeter<T>),
("C/m²", CoulombPerSquareMeter<T>),
("F/m", FaradPerMeter<T>),
("H/m", HenryPerMeter<T>),
("W/(m*K)", WattPerMetreKelvin<T>),
("V/m", VoltPerMetre<T>),
("C/m³", CoulombPerCubicMetre<T>),
("C/m²", CoulombPerSquareMetre<T>),
("F/m", FaradPerMetre<T>),
("H/m", HenryPerMetre<T>),
("J/mol", JoulePerMole<T>),
("J/(mol*K)", JoulePerMoleKelvin<T>),
("C/kg", CoulombPerKilogram<T>),
("Gy/s", GrayPerSecond<T>),
("kat/m³", KatalPerCubicMeter<T>),
("kat/m³", KatalPerCubicMetre<T>),
);
// base units
display_unit_defmt!(f, Second, "s", Meter, Kilogram, Ampere, Kelvin, Mole, Candela);
display_unit_defmt!(f, Meter, "m", Second, Kilogram, Ampere, Kelvin, Mole, Candela);
display_unit_defmt!(f, Kilogram, "kg", Second, Meter, Ampere, Kelvin, Mole, Candela);
display_unit_defmt!(f, Ampere, "A", Second, Meter, Kilogram, Kelvin, Mole, Candela);
display_unit_defmt!(f, Kelvin, "K", Second, Meter, Kilogram, Ampere, Mole, Candela);
display_unit_defmt!(f, Mole, "mol", Second, Meter, Kilogram, Ampere, Kelvin, Candela);
display_unit_defmt!(f, Candela, "cd", Second, Meter, Kilogram, Ampere, Kelvin, Mole);
display_unit_defmt!(f, Second, "s", Metre, Kilogram, Ampere, Kelvin, Mole, Candela);
display_unit_defmt!(f, Metre, "m", Second, Kilogram, Ampere, Kelvin, Mole, Candela);
display_unit_defmt!(f, Kilogram, "kg", Second, Metre, Ampere, Kelvin, Mole, Candela);
display_unit_defmt!(f, Ampere, "A", Second, Metre, Kilogram, Kelvin, Mole, Candela);
display_unit_defmt!(f, Kelvin, "K", Second, Metre, Kilogram, Ampere, Mole, Candela);
display_unit_defmt!(f, Mole, "mol", Second, Metre, Kilogram, Ampere, Kelvin, Candela);
display_unit_defmt!(f, Candela, "cd", Second, Metre, Kilogram, Ampere, Kelvin, Mole);
}
}
@ -160,11 +157,11 @@ macro_rules! display_special_unit {
};
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> Display
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Display
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -195,65 +192,67 @@ where
);
// derived units
display_special_unit!(f, Self,
("m/s", MeterPerSecond<T>),
("m/s²", MeterPerSquareSecond<T>),
("kg/m³", KilogramPerCubicMeter<T>),
("kg/m²", KilogramPerSquareMeter<T>),
("m³/kg", CubicMeterPerKilogram<T>),
("A/m²", AmperePerSquareMeter<T>),
("A/m", AmperePerMeter<T>),
("mol/m³", MolePerCubicMeter<T>),
("m/s", MetrePerSecond<T>),
("m/s²", MetrePerSquareSecond<T>),
("kg/m³", KilogramPerCubicMetre<T>),
("kg/m²", KilogramPerSquareMetre<T>),
("m³/kg", CubicMetrePerKilogram<T>),
("A/m²", AmperePerSquareMetre<T>),
("A/m", AmperePerMetre<T>),
("mol/m³", MolePerCubicMetre<T>),
);
// derived units including special names
display_special_unit!(f, Self,
("Pa*s", PascalSecond<T>),
("N/m", NewtonPerMeter<T>),
("W/m²", WattPerSquareMeter<T>),
("N/m", NewtonPerMetre<T>),
("W/m²", WattPerSquareMetre<T>),
("J/K", JoulePerKelvin<T>),
("J/(kg*K)", JoulePerKilogramKelvin<T>),
("W/(m*K)", WattPerMeterKelvin<T>),
("V/m", VoltPerMeter<T>),
("C/m³", CoulombPerCubicMeter<T>),
("C/m²", CoulombPerSquareMeter<T>),
("F/m", FaradPerMeter<T>),
("H/m", HenryPerMeter<T>),
("W/(m*K)", WattPerMetreKelvin<T>),
("V/m", VoltPerMetre<T>),
("C/m³", CoulombPerCubicMetre<T>),
("C/m²", CoulombPerSquareMetre<T>),
("F/m", FaradPerMetre<T>),
("H/m", HenryPerMetre<T>),
("J/mol", JoulePerMole<T>),
("J/(mol*K)", JoulePerMoleKelvin<T>),
("C/kg", CoulombPerKilogram<T>),
("Gy/s", GrayPerSecond<T>),
("kat/m³", KatalPerCubicMeter<T>),
("kat/m³", KatalPerCubicMetre<T>),
);
// base units
display_unit!(f, Second, "s", Meter, Kilogram, Ampere, Kelvin, Mole, Candela);
display_unit!(f, Meter, "m", Second, Kilogram, Ampere, Kelvin, Mole, Candela);
display_unit!(f, Kilogram, "kg", Second, Meter, Ampere, Kelvin, Mole, Candela);
display_unit!(f, Ampere, "A", Second, Meter, Kilogram, Kelvin, Mole, Candela);
display_unit!(f, Kelvin, "K", Second, Meter, Kilogram, Ampere, Mole, Candela);
display_unit!(f, Mole, "mol", Second, Meter, Kilogram, Ampere, Kelvin, Candela);
display_unit!(f, Candela, "cd", Second, Meter, Kilogram, Ampere, Kelvin, Mole);
display_unit!(f, Second, "s", Metre, Kilogram, Ampere, Kelvin, Mole, Candela);
display_unit!(f, Metre, "m", Second, Kilogram, Ampere, Kelvin, Mole, Candela);
display_unit!(f, Kilogram, "kg", Second, Metre, Ampere, Kelvin, Mole, Candela);
display_unit!(f, Ampere, "A", Second, Metre, Kilogram, Kelvin, Mole, Candela);
display_unit!(f, Kelvin, "K", Second, Metre, Kilogram, Ampere, Mole, Candela);
display_unit!(f, Mole, "mol", Second, Metre, Kilogram, Ampere, Kelvin, Candela);
display_unit!(f, Candela, "cd", Second, Metre, Kilogram, Ampere, Kelvin, Mole);
Ok(())
}
}
#[cfg(test)]
mod test {
use crate::types::{Ampere, Candela, Kelvin, Kilogram, Meter, Mole, Second, Unit};
use crate::types::{Ampere, Candela, Kelvin, Kilogram, Metre, Mole, Second, Unit};
use super::*;
#[test]
#[cfg(feature = "std")]
fn debug() {
let m = Meter::new(2);
let m = Metre::new(2);
assert_eq!(format!("{m:?}"), "SiUnit { value: 2, _s: PhantomData<typenum::int::Z0>, _m: PhantomData<typenum::int::PInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>>>, _kg: PhantomData<typenum::int::Z0>, _a: PhantomData<typenum::int::Z0>, _k: PhantomData<typenum::int::Z0>, _mol: PhantomData<typenum::int::Z0>, _cd: PhantomData<typenum::int::Z0> }".to_owned());
}
#[test]
#[allow(clippy::cognitive_complexity)]
#[cfg(feature = "std")]
fn display() {
let unit = Unit::new(2);
let second = Second::new(2);
let meter = Meter::new(2);
let meter = Metre::new(2);
let kilogram = Kilogram::new(2);
let ampere = Ampere::new(2);
let kelvin = Kelvin::new(2);
@ -299,30 +298,30 @@ mod test {
assert_eq!(Gray::new(2).to_string(), "2Gy|Sv");
assert_eq!(Katal::new(2).to_string(), "2kat");
assert_eq!(MeterPerSecond::new(2).to_string(), "2m/s");
assert_eq!(MeterPerSquareSecond::new(2).to_string(), "2m/s²");
assert_eq!(KilogramPerCubicMeter::new(2).to_string(), "2kg/m³");
assert_eq!(KilogramPerSquareMeter::new(2).to_string(), "2kg/m²");
assert_eq!(CubicMeterPerKilogram::new(2).to_string(), "2m³/kg");
assert_eq!(AmperePerSquareMeter::new(2).to_string(), "2A/m²");
assert_eq!(AmperePerMeter::new(2).to_string(), "2A/m");
assert_eq!(MolePerCubicMeter::new(2).to_string(), "2mol/m³");
assert_eq!(MetrePerSecond::new(2).to_string(), "2m/s");
assert_eq!(MetrePerSquareSecond::new(2).to_string(), "2m/s²");
assert_eq!(KilogramPerCubicMetre::new(2).to_string(), "2kg/m³");
assert_eq!(KilogramPerSquareMetre::new(2).to_string(), "2kg/m²");
assert_eq!(CubicMetrePerKilogram::new(2).to_string(), "2m³/kg");
assert_eq!(AmperePerSquareMetre::new(2).to_string(), "2A/m²");
assert_eq!(AmperePerMetre::new(2).to_string(), "2A/m");
assert_eq!(MolePerCubicMetre::new(2).to_string(), "2mol/m³");
assert_eq!(PascalSecond::new(2).to_string(), "2Pa*s");
assert_eq!(NewtonPerMeter::new(2).to_string(), "2N/m");
assert_eq!(WattPerSquareMeter::new(2).to_string(), "2W/m²");
assert_eq!(NewtonPerMetre::new(2).to_string(), "2N/m");
assert_eq!(WattPerSquareMetre::new(2).to_string(), "2W/m²");
assert_eq!(JoulePerKelvin::new(2).to_string(), "2J/K");
assert_eq!(JoulePerKilogramKelvin::new(2).to_string(), "2J/(kg*K)");
assert_eq!(WattPerMeterKelvin::new(2).to_string(), "2W/(m*K)");
assert_eq!(VoltPerMeter::new(2).to_string(), "2V/m");
assert_eq!(CoulombPerCubicMeter::new(2).to_string(), "2C/m³");
assert_eq!(CoulombPerSquareMeter::new(2).to_string(), "2C/m²");
assert_eq!(FaradPerMeter::new(2).to_string(), "2F/m");
assert_eq!(HenryPerMeter::new(2).to_string(), "2H/m");
assert_eq!(WattPerMetreKelvin::new(2).to_string(), "2W/(m*K)");
assert_eq!(VoltPerMetre::new(2).to_string(), "2V/m");
assert_eq!(CoulombPerCubicMetre::new(2).to_string(), "2C/m³");
assert_eq!(CoulombPerSquareMetre::new(2).to_string(), "2C/m²");
assert_eq!(FaradPerMetre::new(2).to_string(), "2F/m");
assert_eq!(HenryPerMetre::new(2).to_string(), "2H/m");
assert_eq!(JoulePerMole::new(2).to_string(), "2J/mol");
assert_eq!(JoulePerMoleKelvin::new(2).to_string(), "2J/(mol*K)");
assert_eq!(CoulombPerKilogram::new(2).to_string(), "2C/kg");
assert_eq!(GrayPerSecond::new(2).to_string(), "2Gy/s");
assert_eq!(KatalPerCubicMeter::new(2).to_string(), "2kat/m³");
assert_eq!(KatalPerCubicMetre::new(2).to_string(), "2kat/m³");
}
}

View File

@ -2,7 +2,6 @@
mod display;
pub mod types;
#[cfg(not(feature = "std"))]
use core::{
marker::PhantomData,
ops::{
@ -10,24 +9,16 @@ use core::{
SubAssign,
},
};
#[cfg(feature = "std")]
use std::{
marker::PhantomData,
ops::{
Add, AddAssign, Deref, DerefMut, Div, DivAssign, Mul, MulAssign, Neg, Rem, RemAssign, Sub,
SubAssign,
},
};
use num_traits::{Num, One, Zero};
use typenum::{int::Z0, op, Integer};
use types::Unit;
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
pub struct SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
pub struct SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -36,7 +27,7 @@ where
{
value: T,
_s: PhantomData<Second>,
_m: PhantomData<Meter>,
_m: PhantomData<Metre>,
_kg: PhantomData<Kilogram>,
_a: PhantomData<Ampere>,
_k: PhantomData<Kelvin>,
@ -44,11 +35,11 @@ where
_cd: PhantomData<Candela>,
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> Deref
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Deref
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -62,11 +53,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> DerefMut
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> DerefMut
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -78,11 +69,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> Neg
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Neg
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -90,18 +81,18 @@ where
Candela: Integer,
T: Neg,
{
type Output = SiUnit<T::Output, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>;
type Output = SiUnit<T::Output, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>;
fn neg(self) -> Self::Output {
Self::Output::new(-self.value)
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> Zero
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Zero
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -118,11 +109,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> One
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> One
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer + Add<Output = Second>,
Meter: Integer + Add<Output = Meter>,
Metre: Integer + Add<Output = Metre>,
Kilogram: Integer + Add<Output = Kilogram>,
Ampere: Integer + Add<Output = Ampere>,
Kelvin: Integer + Add<Output = Kelvin>,
@ -130,7 +121,7 @@ where
Candela: Integer + Add<Output = Candela>,
T: One,
<Second as Add>::Output: Integer,
<Meter as Add>::Output: Integer,
<Metre as Add>::Output: Integer,
<Kilogram as Add>::Output: Integer,
<Ampere as Add>::Output: Integer,
<Kelvin as Add>::Output: Integer,
@ -142,11 +133,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> Num
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Num
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer + Add<Output = Second> + Sub<Output = Second> + PartialEq,
Meter: Integer + Add<Output = Meter> + Sub<Output = Meter> + PartialEq,
Metre: Integer + Add<Output = Metre> + Sub<Output = Metre> + PartialEq,
Kilogram: Integer + Add<Output = Kilogram> + Sub<Output = Kilogram> + PartialEq,
Ampere: Integer + Add<Output = Ampere> + Sub<Output = Ampere> + PartialEq,
Kelvin: Integer + Add<Output = Kelvin> + Sub<Output = Kelvin> + PartialEq,
@ -161,11 +152,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> Add
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Add
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -173,18 +164,18 @@ where
Candela: Integer,
T: Add,
{
type Output = SiUnit<T::Output, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>;
type Output = SiUnit<T::Output, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>;
fn add(self, rhs: Self) -> Self::Output {
Self::Output::new(self.value + rhs.value)
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> AddAssign
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> AddAssign
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -197,11 +188,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> Sub
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Sub
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -209,18 +200,18 @@ where
Candela: Integer,
T: Sub,
{
type Output = SiUnit<T::Output, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>;
type Output = SiUnit<T::Output, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>;
fn sub(self, rhs: Self) -> Self::Output {
Self::Output::new(self.value - rhs.value)
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> SubAssign
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> SubAssign
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -233,11 +224,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> Mul<T>
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Mul<T>
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -252,11 +243,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> MulAssign<T>
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> MulAssign<T>
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -269,11 +260,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> Div<T>
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Div<T>
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer + Sub<Z0>,
Meter: Integer + Sub<Z0>,
Metre: Integer + Sub<Z0>,
Kilogram: Integer + Sub<Z0>,
Ampere: Integer + Sub<Z0>,
Kelvin: Integer + Sub<Z0>,
@ -281,7 +272,7 @@ where
Candela: Integer + Sub<Z0>,
T: Div,
<Second as Sub<Z0>>::Output: Integer,
<Meter as Sub<Z0>>::Output: Integer,
<Metre as Sub<Z0>>::Output: Integer,
<Kilogram as Sub<Z0>>::Output: Integer,
<Ampere as Sub<Z0>>::Output: Integer,
<Kelvin as Sub<Z0>>::Output: Integer,
@ -295,11 +286,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> DivAssign<T>
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> DivAssign<T>
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -312,11 +303,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> Rem<T>
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Rem<T>
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer + Sub<Z0>,
Meter: Integer + Sub<Z0>,
Metre: Integer + Sub<Z0>,
Kilogram: Integer + Sub<Z0>,
Ampere: Integer + Sub<Z0>,
Kelvin: Integer + Sub<Z0>,
@ -324,7 +315,7 @@ where
Candela: Integer + Sub<Z0>,
T: Rem,
<Second as Sub<Z0>>::Output: Integer,
<Meter as Sub<Z0>>::Output: Integer,
<Metre as Sub<Z0>>::Output: Integer,
<Kilogram as Sub<Z0>>::Output: Integer,
<Ampere as Sub<Z0>>::Output: Integer,
<Kelvin as Sub<Z0>>::Output: Integer,
@ -338,11 +329,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela> RemAssign<T>
for SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> RemAssign<T>
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -355,11 +346,11 @@ where
}
}
impl<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
SiUnit<T, Second, Meter, Kilogram, Ampere, Kelvin, Mole, Candela>
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Meter: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
@ -383,21 +374,21 @@ where
impl<
T,
Second1,
Meter1,
Metre1,
Kilogram1,
Ampere1,
Kelvin1,
Mole1,
Candela1,
Second2,
Meter2,
Metre2,
Kilogram2,
Ampere2,
Kelvin2,
Mole2,
Candela2,
> Mul<SiUnit<T, Second1, Meter1, Kilogram1, Ampere1, Kelvin1, Mole1, Candela1>>
for SiUnit<T, Second2, Meter2, Kilogram2, Ampere2, Kelvin2, Mole2, Candela2>
> Mul<SiUnit<T, Second1, Metre1, Kilogram1, Ampere1, Kelvin1, Mole1, Candela1>>
for SiUnit<T, Second2, Metre2, Kilogram2, Ampere2, Kelvin2, Mole2, Candela2>
where
Mole2: Integer,
Candela2: Integer,
@ -406,16 +397,16 @@ where
Kelvin1: Integer + Add<Kelvin2>,
Ampere1: Integer + Add<Ampere2>,
Kilogram1: Integer + Add<Kilogram2>,
Meter1: Integer + Add<Meter2>,
Metre1: Integer + Add<Metre2>,
Second1: Integer + Add<Second2>,
Kelvin2: Integer,
Ampere2: Integer,
Kilogram2: Integer,
Meter2: Integer,
Metre2: Integer,
Second2: Integer,
T: Mul,
Second1::Output: Integer,
Meter1::Output: Integer,
Metre1::Output: Integer,
Kilogram1::Output: Integer,
Ampere1::Output: Integer,
Kelvin1::Output: Integer,
@ -425,7 +416,7 @@ where
type Output = SiUnit<
T::Output,
op!(Second1 + Second2),
op!(Meter1 + Meter2),
op!(Metre1 + Metre2),
op!(Kilogram1 + Kilogram2),
op!(Ampere1 + Ampere2),
op!(Kelvin1 + Kelvin2),
@ -435,7 +426,7 @@ where
fn mul(
self,
rhs: SiUnit<T, Second1, Meter1, Kilogram1, Ampere1, Kelvin1, Mole1, Candela1>,
rhs: SiUnit<T, Second1, Metre1, Kilogram1, Ampere1, Kelvin1, Mole1, Candela1>,
) -> Self::Output {
Self::Output::new(self.value * rhs.value)
}
@ -444,31 +435,31 @@ where
impl<
T,
Second1,
Meter1,
Metre1,
Kilogram1,
Ampere1,
Kelvin1,
Mole1,
Candela1,
Second2,
Meter2,
Metre2,
Kilogram2,
Ampere2,
Kelvin2,
Mole2,
Candela2,
> Div<SiUnit<T, Second1, Meter1, Kilogram1, Ampere1, Kelvin1, Mole1, Candela1>>
for SiUnit<T, Second2, Meter2, Kilogram2, Ampere2, Kelvin2, Mole2, Candela2>
> Div<SiUnit<T, Second1, Metre1, Kilogram1, Ampere1, Kelvin1, Mole1, Candela1>>
for SiUnit<T, Second2, Metre2, Kilogram2, Ampere2, Kelvin2, Mole2, Candela2>
where
Second1: Integer,
Meter1: Integer,
Metre1: Integer,
Kilogram1: Integer,
Ampere1: Integer,
Kelvin1: Integer,
Mole1: Integer,
Candela1: Integer,
Second2: Integer + Sub<Second1>,
Meter2: Integer + Sub<Meter1>,
Metre2: Integer + Sub<Metre1>,
Kilogram2: Integer + Sub<Kilogram1>,
Ampere2: Integer + Sub<Ampere1>,
Kelvin2: Integer + Sub<Kelvin1>,
@ -476,7 +467,7 @@ where
Candela2: Integer + Sub<Candela1>,
T: Div,
Second2::Output: Integer,
Meter2::Output: Integer,
Metre2::Output: Integer,
Kilogram2::Output: Integer,
Ampere2::Output: Integer,
Kelvin2::Output: Integer,
@ -486,7 +477,7 @@ where
type Output = SiUnit<
T::Output,
op!(Second2 - Second1),
op!(Meter2 - Meter1),
op!(Metre2 - Metre1),
op!(Kilogram2 - Kilogram1),
op!(Ampere2 - Ampere1),
op!(Kelvin2 - Kelvin1),
@ -496,7 +487,7 @@ where
fn div(
self,
rhs: SiUnit<T, Second1, Meter1, Kilogram1, Ampere1, Kelvin1, Mole1, Candela1>,
rhs: SiUnit<T, Second1, Metre1, Kilogram1, Ampere1, Kelvin1, Mole1, Candela1>,
) -> Self::Output {
Self::Output::new(self.value / rhs.value)
}
@ -505,31 +496,31 @@ where
impl<
T,
Second1,
Meter1,
Metre1,
Kilogram1,
Ampere1,
Kelvin1,
Mole1,
Candela1,
Second2,
Meter2,
Metre2,
Kilogram2,
Ampere2,
Kelvin2,
Mole2,
Candela2,
> Rem<SiUnit<T, Second1, Meter1, Kilogram1, Ampere1, Kelvin1, Mole1, Candela1>>
for SiUnit<T, Second2, Meter2, Kilogram2, Ampere2, Kelvin2, Mole2, Candela2>
> Rem<SiUnit<T, Second1, Metre1, Kilogram1, Ampere1, Kelvin1, Mole1, Candela1>>
for SiUnit<T, Second2, Metre2, Kilogram2, Ampere2, Kelvin2, Mole2, Candela2>
where
Second1: Integer,
Meter1: Integer,
Metre1: Integer,
Kilogram1: Integer,
Ampere1: Integer,
Kelvin1: Integer,
Mole1: Integer,
Candela1: Integer,
Second2: Integer + Sub<Second1>,
Meter2: Integer + Sub<Meter1>,
Metre2: Integer + Sub<Metre1>,
Kilogram2: Integer + Sub<Kilogram1>,
Ampere2: Integer + Sub<Ampere1>,
Kelvin2: Integer + Sub<Kelvin1>,
@ -537,7 +528,7 @@ where
Candela2: Integer + Sub<Candela1>,
T: Rem,
Second2::Output: Integer,
Meter2::Output: Integer,
Metre2::Output: Integer,
Kilogram2::Output: Integer,
Ampere2::Output: Integer,
Kelvin2::Output: Integer,
@ -547,7 +538,7 @@ where
type Output = SiUnit<
T::Output,
op!(Second2 - Second1),
op!(Meter2 - Meter1),
op!(Metre2 - Metre1),
op!(Kilogram2 - Kilogram1),
op!(Ampere2 - Ampere1),
op!(Kelvin2 - Kelvin1),
@ -557,7 +548,7 @@ where
fn rem(
self,
rhs: SiUnit<T, Second1, Meter1, Kilogram1, Ampere1, Kelvin1, Mole1, Candela1>,
rhs: SiUnit<T, Second1, Metre1, Kilogram1, Ampere1, Kelvin1, Mole1, Candela1>,
) -> Self::Output {
Self::Output::new(self.value % rhs.value)
}
@ -566,20 +557,20 @@ where
#[cfg(test)]
mod test {
use super::types::{
Ampere, Coulomb, CubicMeter, Meter, ReciprocalMeter, Second, SquareMeter, Unit, Volt, Watt,
Ampere, Coulomb, CubicMetre, Metre, ReciprocalMetre, Second, SquareMetre, Unit, Volt, Watt,
};
use num_traits::{Num, One, Zero};
#[test]
fn clone() {
let m = Meter::new(2);
let m = Metre::new(2);
assert_eq!(m.clone(), m);
}
#[test]
fn ord() {
let a = Meter::new(2);
let b = Meter::new(3);
let a = Metre::new(2);
let b = Metre::new(3);
assert!(a < b);
assert!(b > a);
assert!(a == a);
@ -590,27 +581,27 @@ mod test {
#[test]
fn deref() {
let m = Meter::new(2);
let m = Metre::new(2);
assert_eq!(*m, 2);
}
#[test]
fn deref_mut() {
let mut m = Meter::new(2);
let mut m = Metre::new(2);
*m = 3;
assert_eq!(*m, 3);
}
#[test]
fn neg() {
let m = Meter::new(2);
assert_eq!(-m, Meter::new(-2));
let m = Metre::new(2);
assert_eq!(-m, Metre::new(-2));
}
#[test]
fn zero() {
let z = Meter::zero();
assert_eq!(z, Meter::new(0));
let z = Metre::zero();
assert_eq!(z, Metre::new(0));
assert!(z.is_zero());
}
@ -627,89 +618,89 @@ mod test {
#[test]
fn add() {
let m = Meter::new(2);
assert_eq!(m + m, Meter::new(4));
assert_eq!(m + m + m, Meter::new(6));
let m = Metre::new(2);
assert_eq!(m + m, Metre::new(4));
assert_eq!(m + m + m, Metre::new(6));
}
#[test]
fn add_assign() {
let mut m = Meter::new(2);
let mut m = Metre::new(2);
m += m;
assert_eq!(m, Meter::new(4));
assert_eq!(m, Metre::new(4));
}
#[test]
fn sub() {
let m = Meter::new(2);
assert_eq!(m - m, Meter::new(0));
assert_eq!(m - m - m, Meter::new(-2));
let m = Metre::new(2);
assert_eq!(m - m, Metre::new(0));
assert_eq!(m - m - m, Metre::new(-2));
}
#[test]
fn sub_assign() {
let mut m = Meter::new(2);
let mut m = Metre::new(2);
m -= m;
assert_eq!(m, Meter::new(0));
assert_eq!(m, Metre::new(0));
}
#[test]
fn mul() {
let m = Meter::new(2);
assert_eq!(m * m, SquareMeter::new(4));
assert_eq!(m * m * m, CubicMeter::new(8));
let m = Metre::new(2);
assert_eq!(m * m, SquareMetre::new(4));
assert_eq!(m * m * m, CubicMetre::new(8));
let s = Second::new(1);
let a = Ampere::new(2);
assert_eq!(s * a, Coulomb::new(2));
let v = Volt::new(2);
assert_eq!(v * a, Watt::new(4));
assert_eq!(m * 2, Meter::new(4));
assert_eq!(m * 2, Metre::new(4));
}
#[test]
fn mul_assign() {
let mut m = Meter::new(2);
let mut m = Metre::new(2);
m *= 2;
assert_eq!(m, Meter::new(4));
assert_eq!(m, Metre::new(4));
}
#[test]
fn div() {
let m = Meter::new(2);
let m = Metre::new(2);
assert_eq!(m / m, Unit::new(1));
assert_eq!(m / m / m, ReciprocalMeter::new(0));
assert_eq!(m / m / m, ReciprocalMetre::new(0));
let c = Coulomb::new(4);
let a = Ampere::new(2);
assert_eq!(c / a, Second::new(2));
let w = Watt::new(2);
assert_eq!(w / a, Volt::new(1));
assert_eq!(m / 2, Meter::new(1));
assert_eq!(m / 2, Metre::new(1));
}
#[test]
fn div_assign() {
let mut m = Meter::new(2);
let mut m = Metre::new(2);
m /= 2;
assert_eq!(m, Meter::new(1));
assert_eq!(m, Metre::new(1));
}
#[test]
fn rem() {
let m = Meter::new(2);
let m = Metre::new(2);
assert_eq!(m % m, Unit::new(0));
assert_eq!(m / m % m, ReciprocalMeter::new(1));
assert_eq!(m / m % m, ReciprocalMetre::new(1));
let c = Coulomb::new(4);
let a = Ampere::new(2);
assert_eq!(c % a, Second::new(0));
let w = Watt::new(2);
assert_eq!(w % a, Volt::new(0));
assert_eq!(m % 2, Meter::new(0));
assert_eq!(m % 2, Metre::new(0));
}
#[test]
fn rem_assign() {
let mut m = Meter::new(2);
let mut m = Metre::new(2);
m %= 2;
assert_eq!(m, Meter::new(0));
assert_eq!(m, Metre::new(0));
}
}

View File

@ -6,7 +6,7 @@ pub type Unit<T> = SiUnit<T, Z0, Z0, Z0, Z0, Z0, Z0, Z0>;
/// time
pub type Second<T> = SiUnit<T, P1, Z0, Z0, Z0, Z0, Z0, Z0>;
/// length
pub type Meter<T> = SiUnit<T, Z0, P1, Z0, Z0, Z0, Z0, Z0>;
pub type Metre<T> = SiUnit<T, Z0, P1, Z0, Z0, Z0, Z0, Z0>;
/// mass
pub type Kilogram<T> = SiUnit<T, Z0, Z0, P1, Z0, Z0, Z0, Z0>;
/// electric current
@ -64,43 +64,43 @@ pub type Katal<T> = SiUnit<T, N1, Z0, Z0, Z0, Z0, P1, Z0>;
// Derived units without special names
/// area
pub type SquareMeter<T> = SiUnit<T, Z0, P2, Z0, Z0, Z0, Z0, Z0>;
pub type SquareMetre<T> = SiUnit<T, Z0, P2, Z0, Z0, Z0, Z0, Z0>;
/// volume
pub type CubicMeter<T> = SiUnit<T, Z0, P3, Z0, Z0, Z0, Z0, Z0>;
pub type CubicMetre<T> = SiUnit<T, Z0, P3, Z0, Z0, Z0, Z0, Z0>;
/// speed, velocity
pub type MeterPerSecond<T> = SiUnit<T, N1, P1, Z0, Z0, Z0, Z0, Z0>;
pub type MetrePerSecond<T> = SiUnit<T, N1, P1, Z0, Z0, Z0, Z0, Z0>;
/// acceleration
pub type MeterPerSquareSecond<T> = SiUnit<T, N2, P1, Z0, Z0, Z0, Z0, Z0>;
pub type MetrePerSquareSecond<T> = SiUnit<T, N2, P1, Z0, Z0, Z0, Z0, Z0>;
/// wavenumber, vergence
pub type ReciprocalMeter<T> = SiUnit<T, Z0, N1, Z0, Z0, Z0, Z0, Z0>;
pub type ReciprocalMetre<T> = SiUnit<T, Z0, N1, Z0, Z0, Z0, Z0, Z0>;
/// density, mass concentration
pub type KilogramPerCubicMeter<T> = SiUnit<T, Z0, N3, P1, Z0, Z0, Z0, Z0>;
pub type KilogramPerCubicMetre<T> = SiUnit<T, Z0, N3, P1, Z0, Z0, Z0, Z0>;
/// surface density
pub type KilogramPerSquareMeter<T> = SiUnit<T, Z0, N2, P1, Z0, Z0, Z0, Z0>;
pub type KilogramPerSquareMetre<T> = SiUnit<T, Z0, N2, P1, Z0, Z0, Z0, Z0>;
/// specific density
pub type CubicMeterPerKilogram<T> = SiUnit<T, Z0, P3, N1, Z0, Z0, Z0, Z0>;
pub type CubicMetrePerKilogram<T> = SiUnit<T, Z0, P3, N1, Z0, Z0, Z0, Z0>;
/// current density
pub type AmperePerSquareMeter<T> = SiUnit<T, Z0, N2, Z0, P1, Z0, Z0, Z0>;
pub type AmperePerSquareMetre<T> = SiUnit<T, Z0, N2, Z0, P1, Z0, Z0, Z0>;
/// magnetic field strength
pub type AmperePerMeter<T> = SiUnit<T, Z0, N1, Z0, P1, Z0, Z0, Z0>;
pub type AmperePerMetre<T> = SiUnit<T, Z0, N1, Z0, P1, Z0, Z0, Z0>;
/// concentration
pub type MolePerCubicMeter<T> = SiUnit<T, Z0, N3, Z0, Z0, Z0, P1, Z0>;
pub type MolePerCubicMetre<T> = SiUnit<T, Z0, N3, Z0, Z0, Z0, P1, Z0>;
/// luminance
pub type CandelaPerSquareMeter<T> = SiUnit<T, Z0, N2, Z0, Z0, Z0, Z0, P1>;
pub type CandelaPerSquareMetre<T> = SiUnit<T, Z0, N2, Z0, Z0, Z0, Z0, P1>;
// Derived units including special names
/// dynamic viscosity
pub type PascalSecond<T> = SiUnit<T, N1, N1, P1, Z0, Z0, Z0, Z0>;
/// moment of force
pub type NewtonMeter<T> = SiUnit<T, N2, P2, P1, Z0, Z0, Z0, Z0>;
pub type NewtonMetre<T> = SiUnit<T, N2, P2, P1, Z0, Z0, Z0, Z0>;
/// surface tension
pub type NewtonPerMeter<T> = SiUnit<T, N2, Z0, P1, Z0, Z0, Z0, Z0>;
pub type NewtonPerMetre<T> = SiUnit<T, N2, Z0, P1, Z0, Z0, Z0, Z0>;
/// angular velocity, angular frequency
pub type RadianPerSecond<T> = SiUnit<T, N1, Z0, Z0, Z0, Z0, Z0, Z0>;
/// angular acceleration
pub type RadianPerSquareSecond<T> = SiUnit<T, N2, Z0, Z0, Z0, Z0, Z0, Z0>;
/// heat flux density, irradiance
pub type WattPerSquareMeter<T> = SiUnit<T, N3, Z0, P1, Z0, Z0, Z0, Z0>;
pub type WattPerSquareMetre<T> = SiUnit<T, N3, Z0, P1, Z0, Z0, Z0, Z0>;
/// entropy, heat capacity
pub type JoulePerKelvin<T> = SiUnit<T, N2, P2, P1, Z0, N1, Z0, Z0>;
/// specific heat capacity, specific entropy
@ -108,19 +108,19 @@ pub type JoulePerKilogramKelvin<T> = SiUnit<T, N2, P2, Z0, Z0, N1, Z0, Z0>;
/// specific energy
pub type JoulePerKilogram<T> = SiUnit<T, N2, P2, Z0, Z0, Z0, Z0, Z0>;
/// themal conductivity
pub type WattPerMeterKelvin<T> = SiUnit<T, N3, P1, P1, Z0, N1, Z0, Z0>;
pub type WattPerMetreKelvin<T> = SiUnit<T, N3, P1, P1, Z0, N1, Z0, Z0>;
/// energy density
pub type JoulePerCubicMeter<T> = SiUnit<T, N2, N1, P1, Z0, Z0, Z0, Z0>;
pub type JoulePerCubicMetre<T> = SiUnit<T, N2, N1, P1, Z0, Z0, Z0, Z0>;
/// electric field strength
pub type VoltPerMeter<T> = SiUnit<T, N3, P1, P1, N1, Z0, Z0, Z0>;
pub type VoltPerMetre<T> = SiUnit<T, N3, P1, P1, N1, Z0, Z0, Z0>;
/// electric charge density
pub type CoulombPerCubicMeter<T> = SiUnit<T, P1, N3, Z0, P1, Z0, Z0, Z0>;
pub type CoulombPerCubicMetre<T> = SiUnit<T, P1, N3, Z0, P1, Z0, Z0, Z0>;
/// surface charge density, electirc flusx density, electric displacement
pub type CoulombPerSquareMeter<T> = SiUnit<T, P1, N2, Z0, P1, Z0, Z0, Z0>;
pub type CoulombPerSquareMetre<T> = SiUnit<T, P1, N2, Z0, P1, Z0, Z0, Z0>;
/// permittivity
pub type FaradPerMeter<T> = SiUnit<T, P4, N3, N1, P2, Z0, Z0, Z0>;
pub type FaradPerMetre<T> = SiUnit<T, P4, N3, N1, P2, Z0, Z0, Z0>;
/// permeability
pub type HenryPerMeter<T> = SiUnit<T, N2, P1, P1, N2, Z0, Z0, Z0>;
pub type HenryPerMetre<T> = SiUnit<T, N2, P1, P1, N2, Z0, Z0, Z0>;
/// molar energy
pub type JoulePerMole<T> = SiUnit<T, N2, P2, P1, Z0, Z0, N1, Z0>;
/// molar entropy, molar heat capacity
@ -132,6 +132,6 @@ pub type GrayPerSecond<T> = SiUnit<T, N3, P2, Z0, Z0, Z0, Z0, Z0>;
/// radiant intensity
pub type WattPerSteradian<T> = SiUnit<T, N3, P2, P1, Z0, Z0, Z0, Z0>;
/// radiance
pub type WattPerSquareMeterSteradian<T> = SiUnit<T, N3, Z0, P1, Z0, Z0, Z0, Z0>;
pub type WattPerSquareMetreSteradian<T> = SiUnit<T, N3, Z0, P1, Z0, Z0, Z0, Z0>;
/// catalytic activity concentration
pub type KatalPerCubicMeter<T> = SiUnit<T, N1, N3, Z0, Z0, Z0, P1, Z0>;
pub type KatalPerCubicMetre<T> = SiUnit<T, N1, N3, Z0, Z0, Z0, P1, Z0>;