Numeric

Trait Numeric 

Source
pub trait Numeric:
    Sized
    + Copy
    + PartialEq<Self>
    + Binary
    + Not<Output = Self>
    + BitAnd<Output = Self>
    + BitOr<Output = Self>
    + BitOrAssign<Self>
    + BitXor<Output = Self>
    + Shl<u32, Output = Self>
    + AddAssign<Self> {
    const BITS: u32;

    // Required methods
    fn bit(&self, pos: u32) -> bool;
    fn zero() -> Self;
    fn one() -> Self;
}
Expand description

Trait for numeric types

Required Associated Constants§

Source

const BITS: u32

Number of bits for type

Required Methods§

Source

fn bit(&self, pos: u32) -> bool

Value of bit at pos

Source

fn zero() -> Self

Returns 0 of the type

Source

fn one() -> Self

Returns 1 of the type

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 Numeric for u8

Source§

const BITS: u32 = u8::BITS

Source§

fn bit(&self, pos: u32) -> bool

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

impl Numeric for u16

Source§

const BITS: u32 = u16::BITS

Source§

fn bit(&self, pos: u32) -> bool

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

impl Numeric for u32

Source§

const BITS: u32 = u32::BITS

Source§

fn bit(&self, pos: u32) -> bool

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

impl Numeric for u64

Source§

const BITS: u32 = u64::BITS

Source§

fn bit(&self, pos: u32) -> bool

Source§

fn zero() -> Self

Source§

fn one() -> Self

Source§

impl Numeric for u128

Source§

const BITS: u32 = u128::BITS

Source§

fn bit(&self, pos: u32) -> bool

Source§

fn zero() -> Self

Source§

fn one() -> Self

Implementors§