[][src]Trait num_traits::identities::One

pub trait One: Sized + Mul<Self, Output = Self> {
    fn one() -> Self;

    fn is_one(&self) -> bool
    where
        Self: PartialEq
, { ... } }

Defines a multiplicative identity element for Self.

Required methods

fn one() -> Self

Returns the multiplicative identity element of Self, 1.

Laws

a * 1 = a       ∀ a ∈ Self
1 * a = a       ∀ a ∈ Self

Purity

This function should return the same result at all times regardless of external mutable state, for example values stored in TLS or in static muts.

Loading content...

Provided methods

fn is_one(&self) -> bool where
    Self: PartialEq

Returns true if self is equal to the multiplicative identity.

For performance reasons, it's best to implement this manually. After a semver bump, this method will be required, and the where Self: PartialEq bound will be removed.

Loading content...

Implementations on Foreign Types

impl<T: One> One for Wrapping<T> where
    Wrapping<T>: Mul<Output = Wrapping<T>>, 
[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

Loading content...

Implementors

impl One for f32[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for f64[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for i8[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for i16[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for i32[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for i64[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for i128[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for isize[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for u8[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for u16[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for u32[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for u64[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for u128[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

impl One for usize[src]

fn is_one(&self) -> bool where
    Self: PartialEq
[src]

Loading content...