Trait UnitType

Source
pub trait UnitType:
    Debug
    + Copy
    + PartialEq
    + PartialOrd
    + Serialize
    + Add
    + Sub
    + Div
    + Mul<Dimensionless, Output = Self>
    + AddAssign
    + SubAssign
    + Sum
    + ApproxEq<Margin = F64Margin>
    + Display {
    // Required methods
    fn new(value: f64) -> Self;
    fn value(&self) -> f64;
    fn is_normal(&self) -> bool;
    fn is_finite(&self) -> bool;
    fn abs(&self) -> Self;
    fn max(&self, other: Self) -> Self;
    fn min(&self, other: Self) -> Self;
}
Expand description

A trait encompassing most of the functionality of unit types

Required Methods§

Source

fn new(value: f64) -> Self

Create from an f64 value

Source

fn value(&self) -> f64

Returns the underlying f64 value.

Source

fn is_normal(&self) -> bool

Returns true if the value is a normal number.

Source

fn is_finite(&self) -> bool

Returns true if the value is finite.

Source

fn abs(&self) -> Self

Returns the absolute value of this unit.

Source

fn max(&self, other: Self) -> Self

Returns the max of two values

Source

fn min(&self, other: Self) -> Self

Returns the min of two values

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§