Skip to main content

ConstZero

Trait ConstZero 

Source
pub trait ConstZero: Sized {
    const ZERO: Self;
}
Expand description

Defines an associated constant representing the additive identity element for Self.

This is a pure constant-carrier: it requires only that Self has a compile-time 0, not that it implements Zero (and hence not Add). Keeping it decoupled lets capability-restricted types — e.g. a constant-time integer with bit ops but no arithmetic — supply the 0 constant that PrimBits needs without being forced to implement addition. Numeric types still implement both.

Required Associated Constants§

Source

const ZERO: Self

The additive identity element of Self, 0.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl ConstZero for f32

Source§

const ZERO: Self = 0.0

Source§

impl ConstZero for f64

Source§

const ZERO: Self = 0.0

Source§

impl ConstZero for i8

Source§

const ZERO: Self = 0

Source§

impl ConstZero for i16

Source§

const ZERO: Self = 0

Source§

impl ConstZero for i32

Source§

const ZERO: Self = 0

Source§

impl ConstZero for i64

Source§

const ZERO: Self = 0

Source§

impl ConstZero for i128

Source§

const ZERO: Self = 0

Source§

impl ConstZero for isize

Source§

const ZERO: Self = 0

Source§

impl ConstZero for u8

Source§

const ZERO: Self = 0

Source§

impl ConstZero for u16

Source§

const ZERO: Self = 0

Source§

impl ConstZero for u32

Source§

const ZERO: Self = 0

Source§

impl ConstZero for u64

Source§

const ZERO: Self = 0

Source§

impl ConstZero for u128

Source§

const ZERO: Self = 0

Source§

impl ConstZero for usize

Source§

const ZERO: Self = 0

Source§

impl<T: ConstZero> ConstZero for Saturating<T>
where Saturating<T>: Add<Output = Saturating<T>>,

Source§

const ZERO: Self

Source§

impl<T: ConstZero> ConstZero for Wrapping<T>
where Wrapping<T>: Add<Output = Wrapping<T>>,

Source§

const ZERO: Self

Implementors§