Trait vecmat::prelude::One[][src]

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[src]

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)[src]

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

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

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 i128[src]

pub fn one() -> i128[src]

pub fn is_one(&self) -> bool[src]

impl One for f64[src]

pub fn one() -> f64[src]

pub fn is_one(&self) -> bool[src]

impl One for usize[src]

pub fn one() -> usize[src]

pub fn is_one(&self) -> bool[src]

impl One for i8[src]

pub fn one() -> i8[src]

pub fn is_one(&self) -> bool[src]

impl One for i16[src]

pub fn one() -> i16[src]

pub fn is_one(&self) -> bool[src]

impl One for u64[src]

pub fn one() -> u64[src]

pub fn is_one(&self) -> bool[src]

impl One for u8[src]

pub fn one() -> u8[src]

pub fn is_one(&self) -> bool[src]

impl One for i64[src]

pub fn one() -> i64[src]

pub fn is_one(&self) -> bool[src]

impl One for i32[src]

pub fn one() -> i32[src]

pub fn is_one(&self) -> bool[src]

impl One for u16[src]

pub fn one() -> u16[src]

pub fn is_one(&self) -> bool[src]

impl One for u128[src]

pub fn one() -> u128[src]

pub fn is_one(&self) -> bool[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]

pub fn set_one(&mut self)[src]

pub fn one() -> Wrapping<T>[src]

impl One for u32[src]

pub fn one() -> u32[src]

pub fn is_one(&self) -> bool[src]

impl One for f32[src]

pub fn one() -> f32[src]

pub fn is_one(&self) -> bool[src]

impl One for isize[src]

pub fn one() -> isize[src]

pub fn is_one(&self) -> bool[src]

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

pub fn one() -> Complex<T>[src]

pub fn is_one(&self) -> bool[src]

pub fn set_one(&mut self)[src]

Loading content...

Implementors

impl<T> One for vecmat::complex::Complex<T> where
    T: Zero + One + Sub<Output = T> + Copy
[src]

fn one() -> Self[src]

impl<T> One for Quaternion<T> where
    T: Zero + One + Sub<Output = T> + Copy
[src]

fn one() -> Self[src]

impl<T, const N: usize> One for Matrix<T, N, N> where
    T: One + Zero
[src]

fn one() -> Self[src]

Create identity matrix.

Loading content...