Defines a multiplicative identity element for T.

Signature

pub trait One

Laws

a * 1 = a       ∀ a ∈ T
1 * a = a       ∀ a ∈ T

Trait functions

one

Returns the multiplicative identity element of T, 1.

Signature

fn one() -> T

Examples

use core::num::traits::One;

assert!(One::::one() == 1);

is_one

Returns true if self is equal to the multiplicative identity.

Signature

fn is_one(self: @T) -> bool

Examples

use core::num::traits::One;

assert!(1.is_one());
assert!(!0.is_one());

is_non_one

Returns false if self is equal to the multiplicative identity.

Signature

fn is_non_one(self: @T) -> bool

Examples

use core::num::traits::One;

assert!(0.is_non_one());
assert!(!1.is_non_one());