Skip to main content

One

Trait One 

Source
pub trait One: Sized {
    const ONE: Self;

    // Provided methods
    fn one() -> Self
       where Self: Sized { ... }
    fn set_one(&mut self) -> &mut Self { ... }
    fn is_one(&self) -> bool
       where Self: PartialEq { ... }
    fn is_non_one(&self) -> bool
       where Self: PartialEq { ... }
}
Expand description

Define the 1 representation : The neutral element of the multiplication such that x * X::ONE = x

Required Associated Constants§

Source

const ONE: Self

The neutral element of the multiplication such that x * X::ONE = x

Provided Methods§

Source

fn one() -> Self
where Self: Sized,

Source

fn set_one(&mut self) -> &mut Self

Source

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

Source

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl One for bool

Source§

const ONE: bool = true

Source§

impl One for f32

Source§

impl One for f64

Source§

impl One for i8

Source§

impl One for i16

Source§

impl One for i32

Source§

impl One for i64

Source§

impl One for isize

Source§

impl One for u8

Source§

impl One for u16

Source§

impl One for u32

Source§

impl One for u64

Source§

impl One for usize

Source§

impl<T> One for Saturating<T>
where T: One,

Source§

impl<T> One for Wrapping<T>
where T: One,

Source§

impl<T, const N: usize> One for [T; N]
where T: One,

Implementors§