pub enum PredefUnit {
Show 26 variants
None,
Time,
Length,
Mass,
ElectricCurrent,
Temperature,
AmountOfSubstance,
LuminousIntensity,
Area,
Volume,
ElectricVoltage,
Force,
Torque,
Power,
Energy,
Frequency,
Velocity,
AngularVelocity,
MagneticFlux,
MagneticFluxDensity,
MagneticFieldStrength,
Inductance,
ElectricConductance,
ElectricResistance,
ElectricConductivity,
ElectricResistivity,
}Expand description
An enum representing predefined Units.
This enum serves two purposes:
use dyn_quantity::{Unit, PredefUnit};
let unit: Unit = PredefUnit::ElectricCurrent.into();
assert_eq!(unit.ampere, 1);
let unit: Unit = PredefUnit::Area.into();
assert_eq!(unit.meter, 2);- When deserializing an
Unit, it can be used instead of the explicit struct implementation:
use dyn_quantity::Unit;
let str = "Volume";
let unit: Unit = serde_yaml::from_str(str).unwrap();
assert_eq!(unit.meter, 3);Variants§
None
No unit
Time
SI base units representation: s (second)
Length
SI base units representation: m (meter)
Mass
SI base units representation: kg (kilogram)
ElectricCurrent
SI base units representation: A (ampere)
Temperature
SI base units representation: K (kelvin)
AmountOfSubstance
SI base units representation: mol (mol)
LuminousIntensity
SI base units representation: cd (candela)
Area
SI base units representation: m^2 (square meter)
Volume
SI base units representation: m^3 (cubic meter)
ElectricVoltage
SI base units representation: s^-3m^2kgA-1 (voltage)
Force
SI base units representation: s^-2mkg (newton)
Torque
SI base units representation: s^-2m^2kg (newton meter)
Power
SI base units representation: s^-3m^2kg (watt)
Energy
SI base units representation: s^-2m^2kg (energy)
Frequency
SI base units representation: s^-1 (hertz)
Velocity
SI base units representation: s^-1*m (meter per second)
AngularVelocity
SI base units representation: s^-1 (rad per second)
MagneticFlux
SI base units representation: s^-2m^2kg*A^-1 (weber)
MagneticFluxDensity
SI base units representation: s^-2kgA^-1 (tesla)
MagneticFieldStrength
SI base units representation: m*A^-1 (ampere per meter)
Inductance
SI base units representation: s^-2m^2kg*A^-2 (henry)
ElectricConductance
SI base units representation: s^3m^-2kg^-1*A^2 (siemens)
ElectricResistance
SI base units representation: s^-3m^2kg*A^-2 (ohm)
ElectricConductivity
SI base units representation: s^3m^-2kg^-1*A^2 (siemens)
ElectricResistivity
SI base units representation: s^-3m^3kg*A^-2 (ohm)
Trait Implementations§
Source§impl Clone for PredefUnit
impl Clone for PredefUnit
Source§fn clone(&self) -> PredefUnit
fn clone(&self) -> PredefUnit
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more