pub struct Dimension { /* private fields */ }Expand description
A physical dimension: a vector of rational exponents over BaseDim. The group operation is
mul (axiswise exponent addition); the identity is Dimension::DIMENSIONLESS; the inverse
is Dimension::recip.
Implementations§
Source§impl Dimension
impl Dimension
Sourcepub const DIMENSIONLESS: Dimension
pub const DIMENSIONLESS: Dimension
The identity dimension — the all-zero exponent vector (a pure number, e.g. a count or ratio).
Sourcepub fn base(d: BaseDim) -> Dimension
pub fn base(d: BaseDim) -> Dimension
The dimension of a single base axis raised to the first power (e.g. base(Length) = L).
Sourcepub fn from_exps(e: [Exp; 10]) -> Dimension
pub fn from_exps(e: [Exp; 10]) -> Dimension
Build a dimension directly from its exponent vector (in BaseDim::ALL order) — the inverse
of reading exponent for each axis. Used to reconstruct a dimension from
the wire, where the exponents travel as their (numerator, denominator) pairs.
Sourcepub fn is_dimensionless(self) -> bool
pub fn is_dimensionless(self) -> bool
True for the dimensionless identity (every exponent zero).
Sourcepub fn mul(self, other: Dimension) -> Dimension
pub fn mul(self, other: Dimension) -> Dimension
self × other — axiswise exponent ADDITION (Length × Length = Length²).
Sourcepub fn div(self, other: Dimension) -> Dimension
pub fn div(self, other: Dimension) -> Dimension
self ÷ other — axiswise exponent SUBTRACTION (Area ÷ Length = Length).
Sourcepub fn recip(self) -> Dimension
pub fn recip(self) -> Dimension
1 / self — the multiplicative inverse (negate every exponent). Frequency = recip(Time).
Sourcepub fn powi(self, k: i32) -> Dimension
pub fn powi(self, k: i32) -> Dimension
self^k — the kth power (scale every exponent). powi(0) is dimensionless.
Sourcepub fn nth_root(self, k: i32) -> Dimension
pub fn nth_root(self, k: i32) -> Dimension
The kth root — divide every exponent by k (nth_root(Area, 2) = Length). Panics for k == 0.
pub fn length() -> Dimension
pub fn mass() -> Dimension
pub fn time() -> Dimension
pub fn current() -> Dimension
pub fn temperature() -> Dimension
pub fn amount() -> Dimension
pub fn luminous() -> Dimension
pub fn angle() -> Dimension
pub fn solid_angle() -> Dimension
pub fn information() -> Dimension
pub fn area() -> Dimension
pub fn volume() -> Dimension
pub fn speed() -> Dimension
pub fn acceleration() -> Dimension
pub fn frequency() -> Dimension
pub fn force() -> Dimension
pub fn energy() -> Dimension
pub fn power() -> Dimension
pub fn pressure() -> Dimension
pub fn charge() -> Dimension
pub fn voltage() -> Dimension
pub fn resistance() -> Dimension
pub fn conductance() -> Dimension
pub fn capacitance() -> Dimension
pub fn magnetic_flux() -> Dimension
pub fn inductance() -> Dimension
pub fn magnetic_flux_density() -> Dimension
pub fn surface_tension() -> Dimension
pub fn density() -> Dimension
pub fn absorbed_dose() -> Dimension
pub fn radioactivity() -> Dimension
pub fn exposure() -> Dimension
pub fn catalytic_activity() -> Dimension
pub fn luminous_flux() -> Dimension
pub fn illuminance() -> Dimension
pub fn luminance() -> Dimension
pub fn data_rate() -> Dimension
pub fn volumetric_flow() -> Dimension
pub fn molar_concentration() -> Dimension
pub fn molality() -> Dimension
pub fn dynamic_viscosity() -> Dimension
pub fn kinematic_viscosity() -> Dimension
pub fn fuel_economy() -> Dimension
Sourcepub fn by_name(name: &str) -> Option<Dimension>
pub fn by_name(name: &str) -> Option<Dimension>
Resolve a named dimension (case-insensitive) to its exponent vector — the lookup behind
the Quantity of <Dimension> type annotation (Quantity of Length, Quantity of Area). The
names are the human dimension words, not units; None for an unknown name.