pub enum Dimension {
Length,
Mass,
Time,
Temperature,
Current,
AmountOfSubstance,
LuminousIntensity,
Angle,
Information,
Currency,
}Expand description
Represents a fundamental physical dimension.
Dimensions are the categories that units belong to - for example, both meters
and feet belong to the Length dimension, making them
compatible for conversion.
§Examples
use runits::units::dimension::Dimension;
let length = Dimension::Length;
let mass = Dimension::Mass;
assert_eq!(length.name(), "Length");
assert_eq!(mass.name(), "Mass");Variants§
Length
Spatial extent
SI base unit: meter (m)
Mass
Inertial property
SI base unit: kilogram (kg)
Time
Duration
SI base unit: second (s)
Temperature
Thermodynamic temperature
SI base unit: kelvin (K)
Current
Electric current
SI base unit: ampere (A)
AmountOfSubstance
Amount of substance
SI base unit: mole (mol)
LuminousIntensity
Luminous intensity
SI base unit: candela (cd)
Angle
Planar angle - base unit: radian (rad)
Technically dimensionless in SI, but useful to distinguish angular measurements from pure numbers.
Information
Digital information - base unit: bit
Currency
Monetary value - for currency conversion
Note: Currency conversions require external exchange rate data.
Implementations§
Source§impl Dimension
impl Dimension
Sourcepub fn base_dimensions() -> Vec<Dimension>
pub fn base_dimensions() -> Vec<Dimension>
Returns all seven SI base dimensions.
This excludes derived dimensions like Angle,
Information, and Currency.
§Examples
use runits::units::dimension::Dimension;
let base_dims = Dimension::base_dimensions();
assert_eq!(base_dims.len(), 7);
assert!(base_dims.contains(&Dimension::Length));
assert!(base_dims.contains(&Dimension::Mass));Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
Returns a human-readable name for this dimension.
§Examples
use runits::units::dimension::Dimension;
assert_eq!(Dimension::Length.name(), "Length");
assert_eq!(Dimension::AmountOfSubstance.name(), "Amount");
assert_eq!(Dimension::LuminousIntensity.name(), "Intensity");Sourcepub fn analysis_symbol(&self) -> &'static str
pub fn analysis_symbol(&self) -> &'static str
Standard dimensional analysis symbol (M, L, T, Θ, I, N, J).
These are the single-letter symbols used in physics for dimensional analysis, distinct from both unit symbols (kg, m, s) and dimension names (mass, length, time).
Sourcepub fn base_symbol(&self) -> &'static str
pub fn base_symbol(&self) -> &'static str
Returns the SI base unit symbol for this dimension.
Used by --to-base to render dimensions as unit symbols.
Trait Implementations§
impl Eq for Dimension
impl StructuralPartialEq for Dimension
Auto Trait Implementations§
impl Freeze for Dimension
impl RefUnwindSafe for Dimension
impl Send for Dimension
impl Sync for Dimension
impl Unpin for Dimension
impl UnwindSafe for Dimension
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more