Zero

Trait Zero 

Source
pub trait Zero {
    // Required methods
    fn zero() -> Self;
    fn cmp_zero(&self) -> Option<Ordering>;
}
Expand description

The trait to define scalar (single-dimension) types with a dedicated origin (zero) point.

Currently, it is blanket-implemented for all types that implement TryFrom<u8>, which covers at least all core primitive numeric types (like iN, uN and fN where N is the size in bits).

Required Methods§

Source

fn zero() -> Self

Produce the zero (neutral in terms of sum) element of a type.

Source

fn cmp_zero(&self) -> Option<Ordering>

Determines how the value is comparable to zero.

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§

Source§

impl<T> Zero for T
where T: TryFrom<u8> + PartialOrd,