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

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

Defines a multiplicative identity element for Self.

Laws

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

Required Methods§

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.

Provided Methods§

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

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.

Implementations on Foreign Types§

Implementors§

impl<Frac> One for FixedI8<Frac>where
    Frac: IsLessOrEqual<U6, Output = True> + LeEqU8,

impl<Frac> One for FixedI16<Frac>where
    Frac: IsLessOrEqual<U14, Output = True> + LeEqU16,

impl<Frac> One for FixedI32<Frac>where
    Frac: IsLessOrEqual<U30, Output = True> + LeEqU32,

impl<Frac> One for FixedI64<Frac>where
    Frac: IsLessOrEqual<U62, Output = True> + LeEqU64,

impl<Frac> One for FixedI128<Frac>where
    Frac: IsLessOrEqual<U126, Output = True> + LeEqU128,

impl<Frac> One for FixedU8<Frac>where
    Frac: IsLessOrEqual<U7, Output = True> + LeEqU8,

impl<Frac> One for FixedU16<Frac>where
    Frac: IsLessOrEqual<U15, Output = True> + LeEqU16,

impl<Frac> One for FixedU32<Frac>where
    Frac: IsLessOrEqual<U31, Output = True> + LeEqU32,

impl<Frac> One for FixedU64<Frac>where
    Frac: IsLessOrEqual<U63, Output = True> + LeEqU64,

impl<Frac> One for FixedU128<Frac>where
    Frac: IsLessOrEqual<U127, Output = True> + LeEqU128,

impl<T, D: DimName> One for OMatrix<T, D, D>where
    T: Scalar + Zero + One + ClosedMul + ClosedAdd,
    DefaultAllocator: Allocator<T, D, D>,

impl<T, const D: usize> One for Rotation<T, D>where
    T: Scalar + Zero + One + ClosedAdd + ClosedMul,

impl<T: SimdRealField> One for Quaternion<T>where
    T::Element: SimdRealField,

impl<T: SimdRealField> One for UnitQuaternion<T>where
    T::Element: SimdRealField,

impl<T: SimdRealField> One for DualQuaternion<T>where
    T::Element: SimdRealField,

impl<T: SimdRealField> One for UnitDualQuaternion<T>where
    T::Element: SimdRealField,

impl<T: SimdRealField> One for UnitComplex<T>where
    T::Element: SimdRealField,

impl<T: Scalar + Zero + ClosedAdd, const D: usize> One for Translation<T, D>

impl<T: SimdRealField, R: AbstractRotation<T, D>, const D: usize> One for Isometry<T, R, D>where
    T::Element: SimdRealField,

impl<T: SimdRealField, R, const D: usize> One for Similarity<T, R, D>where
    T::Element: SimdRealField,
    R: AbstractRotation<T, D>,

impl<T: RealField, C: TCategory, const D: usize> One for Transform<T, C, D>where
    Const<D>: DimNameAdd<U1>,
    DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,

impl One for BigInt

impl One for BigUint

impl<T: Clone + Num> One for Complex<T>

impl<T: Clone + Integer> One for Ratio<T>

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

impl One for AutoSimd<[f32; 2]>

impl One for AutoSimd<[f32; 4]>

impl One for AutoSimd<[f32; 8]>

impl One for AutoSimd<[f32; 16]>

impl One for AutoSimd<[f64; 2]>

impl One for AutoSimd<[f64; 4]>

impl One for AutoSimd<[f64; 8]>

impl One for AutoSimd<[i128; 1]>

impl One for AutoSimd<[i128; 2]>

impl One for AutoSimd<[i128; 4]>

impl One for AutoSimd<[i16; 2]>

impl One for AutoSimd<[i16; 4]>

impl One for AutoSimd<[i16; 8]>

impl One for AutoSimd<[i16; 16]>

impl One for AutoSimd<[i16; 32]>

impl One for AutoSimd<[i32; 2]>

impl One for AutoSimd<[i32; 4]>

impl One for AutoSimd<[i32; 8]>

impl One for AutoSimd<[i32; 16]>

impl One for AutoSimd<[i64; 2]>

impl One for AutoSimd<[i64; 4]>

impl One for AutoSimd<[i64; 8]>

impl One for AutoSimd<[i8; 2]>

impl One for AutoSimd<[i8; 4]>

impl One for AutoSimd<[i8; 8]>

impl One for AutoSimd<[i8; 16]>

impl One for AutoSimd<[i8; 32]>

impl One for AutoSimd<[isize; 2]>

impl One for AutoSimd<[isize; 4]>

impl One for AutoSimd<[isize; 8]>

impl One for AutoSimd<[u128; 1]>

impl One for AutoSimd<[u128; 2]>

impl One for AutoSimd<[u128; 4]>

impl One for AutoSimd<[u16; 2]>

impl One for AutoSimd<[u16; 4]>

impl One for AutoSimd<[u16; 8]>

impl One for AutoSimd<[u16; 16]>

impl One for AutoSimd<[u16; 32]>

impl One for AutoSimd<[u32; 2]>

impl One for AutoSimd<[u32; 4]>

impl One for AutoSimd<[u32; 8]>

impl One for AutoSimd<[u32; 16]>

impl One for AutoSimd<[u64; 2]>

impl One for AutoSimd<[u64; 4]>

impl One for AutoSimd<[u64; 8]>

impl One for AutoSimd<[u8; 2]>

impl One for AutoSimd<[u8; 4]>

impl One for AutoSimd<[u8; 8]>

impl One for AutoSimd<[u8; 16]>

impl One for AutoSimd<[u8; 32]>

impl One for AutoSimd<[usize; 2]>

impl One for AutoSimd<[usize; 4]>

impl One for AutoSimd<[usize; 8]>

impl One for BigUint

impl One for FixedI64

impl One for FixedU64

impl One for FixedI128

impl One for FixedU128