Defines an additive identity element for T.

Signature

pub trait Zero

Laws

a + 0 = a       ∀ a ∈ T
0 + a = a       ∀ a ∈ T

Trait functions

zero

Returns the additive identity element of T, 0.

Signature

fn zero() -> T

Examples

use core::num::traits::Zero;

assert!(Zero::::zero() == 0);

is_zero

Returns true if self is equal to the additive identity.

Signature

fn is_zero(self: @T) -> bool

Examples

use core::num::traits::Zero;

assert!(0.is_zero());
assert!(!5.is_zero());

is_non_zero

Returns false if self is equal to the additive identity.

Signature

fn is_non_zero(self: @T) -> bool

Examples

use core::num::traits::Zero;

assert!(5.is_non_zero());
assert!(!0.is_non_zero());