Skip to main content

Unit

Trait Unit 

Source
pub trait Unit:
    Copy
    + Eq
    + Hash
    + Debug
    + 'static {
    const ALL: &'static [Self];
    const NAMES: &'static [&'static str];

    // Required methods
    fn name(self) -> &'static str;
    fn steps(self) -> i64;
}
Expand description

Each unit is a whole number of the quantity’s smallest step: conversion is integer arithmetic.

Required Associated Constants§

Source

const ALL: &'static [Self]

Source

const NAMES: &'static [&'static str]

Required Methods§

Source

fn name(self) -> &'static str

Source

fn steps(self) -> i64

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Unit for EnergyUnit

Source§

const ALL: &'static [Self]

Source§

const NAMES: &'static [&'static str]

Source§

impl Unit for LengthUnit

Source§

const ALL: &'static [Self]

Source§

const NAMES: &'static [&'static str]

Source§

impl Unit for WeightUnit

Source§

const ALL: &'static [Self]

Source§

const NAMES: &'static [&'static str]