pub enum UnitTag {
Show 68 variants
Nanoseconds,
Microseconds,
Milliseconds,
Seconds,
Minutes,
Hours,
Days,
Weeks,
Bytes,
Kibibytes,
Mebibytes,
Gibibytes,
Tebibytes,
Pebibytes,
Exbibytes,
Kilobytes,
Megabytes,
Gigabytes,
Terabytes,
PerSecond,
PerMinute,
PerHour,
RequestsPerSecond,
RequestsPerMinute,
RequestsPerHour,
Percent,
Hertz,
Kilohertz,
Megahertz,
Gigahertz,
Terahertz,
Bits,
Kilobits,
Megabits,
Gigabits,
BitsPerSecond,
KilobitsPerSecond,
MegabitsPerSecond,
GigabitsPerSecond,
MegabytesPerSecond,
Tokens,
KiloTokens,
MegaTokens,
TokensPerSecond,
Flops,
TeraFlops,
PetaFlops,
Pascal,
Bar,
Psi,
Volts,
Amperes,
Watts,
Joules,
KilowattHours,
Newtons,
Degrees,
Radians,
Rpm,
Meters,
Kilometers,
Kilograms,
Grams,
Kelvin,
Celsius,
Fahrenheit,
Decibel,
Named(String),
}Expand description
A unit attached to a quantity.
Variants§
Nanoseconds
Microseconds
Milliseconds
Seconds
Minutes
Hours
Days
Weeks
Bytes
Kibibytes
Mebibytes
Gibibytes
Tebibytes
Pebibytes
Exbibytes
Kilobytes
Megabytes
Gigabytes
Terabytes
PerSecond
PerMinute
PerHour
RequestsPerSecond
RequestsPerMinute
RequestsPerHour
Percent
Hertz
Kilohertz
Megahertz
Gigahertz
Terahertz
Bits
Kilobits
Megabits
Gigabits
BitsPerSecond
KilobitsPerSecond
MegabitsPerSecond
GigabitsPerSecond
MegabytesPerSecond
Tokens
KiloTokens
MegaTokens
TokensPerSecond
Flops
TeraFlops
PetaFlops
Pascal
Bar
Psi
Volts
Amperes
Watts
Joules
KilowattHours
Newtons
Degrees
Radians
Rpm
Meters
Kilometers
Kilograms
Grams
Kelvin
Celsius
Fahrenheit
Decibel
Named(String)
A unit outside the built-in table, identified by its exact name.
Implementations§
Source§impl UnitTag
impl UnitTag
Sourcepub fn discriminant(&self) -> u32
pub fn discriminant(&self) -> u32
Stable wire discriminant. Named is not a discriminant on its own;
callers must also carry the name in the unit table entry.
Sourcepub fn from_discriminant(disc: u32) -> Option<UnitTag>
pub fn from_discriminant(disc: u32) -> Option<UnitTag>
Built-in unit for a discriminant, or None when out of range.
Sourcepub fn is_non_arithmetic(&self) -> bool
pub fn is_non_arithmetic(&self) -> bool
Absolute temperatures and decibels admit equality and ordering but
never arithmetic (active-core spec Ch. 4 §4.1). Preserved so the
binary form cannot be used to smuggle an illegal operation past the
evaluator.
Sourcepub fn is_builtin(&self) -> bool
pub fn is_builtin(&self) -> bool
True for the closed built-in table and false for Named.
Trait Implementations§
impl Eq for UnitTag
Source§impl Ord for UnitTag
impl Ord for UnitTag
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for UnitTag
impl PartialOrd for UnitTag
impl StructuralPartialEq for UnitTag
Auto Trait Implementations§
impl Freeze for UnitTag
impl RefUnwindSafe for UnitTag
impl Send for UnitTag
impl Sync for UnitTag
impl Unpin for UnitTag
impl UnsafeUnpin for UnitTag
impl UnwindSafe for UnitTag
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.