Skip to main content

Ring

Trait Ring 

Source
pub trait Ring:
    Copy
    + Sized
    + PartialEq
    + PartialOrd
    + Debug {
    const ZERO: Self;
    const ONE: Self;
    const TWO: Self;
Show 20 methods // Required methods fn add(self, other: Self) -> Self; fn add_assign(&mut self, other: Self); fn mul(self, other: Self) -> Self; fn mul_assign(&mut self, other: Self); fn sub(self, other: Self) -> Self; fn sub_assign(&mut self, other: Self); fn div(self, other: Self) -> Self; fn div_assign(&mut self, other: Self); fn pow(self, other: u32) -> Self; fn neg(self) -> Self; fn abs(self) -> Self; fn sign(self) -> Self; fn cmp(&self, other: &Self) -> Ordering; fn is_zero(self) -> bool; fn is_nan(self) -> bool; fn is_finite(self) -> bool; fn rem_euclid(self, other: Self) -> Self; // Provided methods fn clamp(self, min: Self, max: Self) -> Self { ... } fn min(self, other: Self) -> Self { ... } fn max(self, other: Self) -> Self { ... }
}

Required Associated Constants§

Source

const ZERO: Self

Source

const ONE: Self

Source

const TWO: Self

Required Methods§

Source

fn add(self, other: Self) -> Self

Source

fn add_assign(&mut self, other: Self)

Source

fn mul(self, other: Self) -> Self

Source

fn mul_assign(&mut self, other: Self)

Source

fn sub(self, other: Self) -> Self

Source

fn sub_assign(&mut self, other: Self)

Source

fn div(self, other: Self) -> Self

Source

fn div_assign(&mut self, other: Self)

Source

fn pow(self, other: u32) -> Self

Source

fn neg(self) -> Self

Source

fn abs(self) -> Self

Source

fn sign(self) -> Self

Source

fn cmp(&self, other: &Self) -> Ordering

Source

fn is_zero(self) -> bool

Source

fn is_nan(self) -> bool

Source

fn is_finite(self) -> bool

Source

fn rem_euclid(self, other: Self) -> Self

Provided Methods§

Source

fn clamp(self, min: Self, max: Self) -> Self

Source

fn min(self, other: Self) -> Self

Source

fn max(self, other: Self) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Ring for bool

Source§

const ZERO: Self = false

Source§

const ONE: Self = true

Source§

const TWO: Self = true

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, _: Self) -> Self

Source§

impl Ring for f32

Source§

const ZERO: Self = 0.

Source§

const ONE: Self = 1.

Source§

const TWO: Self = 2.

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for f64

Source§

const ZERO: Self = 0.

Source§

const ONE: Self = 1.

Source§

const TWO: Self = 2.

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for i8

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self = 2

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for i16

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self = 2

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for i32

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self = 2

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for i64

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self = 2

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for i128

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self = 2

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for isize

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self = 2

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for u8

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self = 2

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for u16

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self = 2

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for u32

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self = 2

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for u64

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self = 2

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for u128

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self = 2

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Source§

impl Ring for usize

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self = 2

Source§

fn add(self, other: Self) -> Self

Source§

fn add_assign(&mut self, other: Self)

Source§

fn mul(self, other: Self) -> Self

Source§

fn mul_assign(&mut self, other: Self)

Source§

fn sub(self, other: Self) -> Self

Source§

fn sub_assign(&mut self, other: Self)

Source§

fn div(self, other: Self) -> Self

Source§

fn div_assign(&mut self, other: Self)

Source§

fn pow(self, other: u32) -> Self

Source§

fn abs(self) -> Self

Source§

fn sign(self) -> Self

Source§

fn neg(self) -> Self

Source§

fn cmp(&self, other: &Self) -> Ordering

Source§

fn is_zero(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn rem_euclid(self, other: Self) -> Self

Implementors§