[][src]Trait nannou::math::prelude::One

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

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

Defines a multiplicative identity element for Self.

Laws

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

Required methods

fn one() -> Self

Returns the multiplicative identity element of Self, 1.

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 set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.

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

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 One for BigUint[src]

fn set_one(&mut self)[src]

impl One for BigInt[src]

fn set_one(&mut self)[src]

impl One for usize[src]

fn set_one(&mut self)[src]

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

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

impl One for isize[src]

fn set_one(&mut self)[src]

impl One for i8[src]

fn set_one(&mut self)[src]

impl One for i16[src]

fn set_one(&mut self)[src]

impl One for i32[src]

fn set_one(&mut self)[src]

impl One for i128[src]

fn set_one(&mut self)[src]

impl One for u32[src]

fn set_one(&mut self)[src]

impl One for u128[src]

fn set_one(&mut self)[src]

impl One for u8[src]

fn set_one(&mut self)[src]

impl One for i64[src]

fn set_one(&mut self)[src]

impl One for f64[src]

fn set_one(&mut self)[src]

impl One for u16[src]

fn set_one(&mut self)[src]

impl One for f32[src]

fn set_one(&mut self)[src]

impl One for u64[src]

fn set_one(&mut self)[src]

impl<T> One for Complex<T> where
    T: Clone + Num
[src]

fn set_one(&mut self)[src]

impl<T> One for Ratio<T> where
    T: Clone + Integer
[src]

fn set_one(&mut self)[src]

impl<T> One for NotNan<T> where
    T: Float

fn set_one(&mut self)[src]

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

impl<T> One for Complex<T> where
    T: Clone + Num
[src]

fn set_one(&mut self)[src]

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

impl One for BigUint[src]

fn set_one(&mut self)[src]

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

impl One for BigInt[src]

fn set_one(&mut self)[src]

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

impl<T> One for Ratio<T> where
    T: Clone + Integer
[src]

fn set_one(&mut self)[src]

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

Loading content...

Implementors

impl<S> One for Basis2<S> where
    S: BaseFloat
[src]

fn set_one(&mut self)[src]

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

impl<S> One for Basis3<S> where
    S: BaseFloat
[src]

fn set_one(&mut self)[src]

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

impl<S> One for Matrix2<S> where
    S: BaseFloat
[src]

fn set_one(&mut self)[src]

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

impl<S> One for Matrix3<S> where
    S: BaseFloat
[src]

fn set_one(&mut self)[src]

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

impl<S> One for Matrix4<S> where
    S: BaseFloat
[src]

fn set_one(&mut self)[src]

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

impl<S> One for Quaternion<S> where
    S: BaseFloat
[src]

fn set_one(&mut self)[src]

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

Loading content...