Trait Common

Source
pub trait Common:
    Default
    + PartialOrd
    + Debug {
    type Array: Array<Output = u8>;

    const ZERO: Self;
    const ONE: Self;
    const MAX: Self;
    const BYTES: u8 = _;
    const BITS: u8 = _;

    // Required methods
    fn leading_zeros(&self) -> u8;
    fn trailing_zeros(&self) -> u8;
    fn count_ones(&self) -> u8;

    // Provided method
    fn log2(&self) -> u8 { ... }
}

Required Associated Constants§

Source

const ZERO: Self

Source

const ONE: Self

Source

const MAX: Self

Provided Associated Constants§

Source

const BYTES: u8 = _

Source

const BITS: u8 = _

Required Associated Types§

Source

type Array: Array<Output = u8>

Required Methods§

Source

fn leading_zeros(&self) -> u8

Source

fn trailing_zeros(&self) -> u8

Source

fn count_ones(&self) -> u8

Provided Methods§

Source

fn log2(&self) -> u8

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

Source§

const ZERO: Self = 0u8

Source§

const ONE: Self = 1u8

Source§

const MAX: Self = 255u8

Source§

type Array = [u8; 1]

Source§

fn leading_zeros(&self) -> u8

Source§

fn trailing_zeros(&self) -> u8

Source§

fn count_ones(&self) -> u8

Source§

impl Common for u16

Source§

const ZERO: Self = 0u16

Source§

const ONE: Self = 1u16

Source§

const MAX: Self = 65_535u16

Source§

type Array = [u8; 2]

Source§

fn leading_zeros(&self) -> u8

Source§

fn trailing_zeros(&self) -> u8

Source§

fn count_ones(&self) -> u8

Source§

impl Common for u32

Source§

const ZERO: Self = 0u32

Source§

const ONE: Self = 1u32

Source§

const MAX: Self = 4_294_967_295u32

Source§

type Array = [u8; 4]

Source§

fn leading_zeros(&self) -> u8

Source§

fn trailing_zeros(&self) -> u8

Source§

fn count_ones(&self) -> u8

Source§

impl Common for u64

Source§

const ZERO: Self = 0u64

Source§

const ONE: Self = 1u64

Source§

const MAX: Self = 18_446_744_073_709_551_615u64

Source§

type Array = [u8; 8]

Source§

fn leading_zeros(&self) -> u8

Source§

fn trailing_zeros(&self) -> u8

Source§

fn count_ones(&self) -> u8

Source§

impl Common for u128

Source§

const ZERO: Self = 0u128

Source§

const ONE: Self = 1u128

Source§

const MAX: Self = 340_282_366_920_938_463_463_374_607_431_768_211_455u128

Source§

type Array = [u8; 16]

Source§

fn leading_zeros(&self) -> u8

Source§

fn trailing_zeros(&self) -> u8

Source§

fn count_ones(&self) -> u8

Source§

impl Common for usize

Source§

const ZERO: Self = 0usize

Source§

const ONE: Self = 1usize

Source§

const MAX: Self = 18_446_744_073_709_551_615usize

Source§

type Array = [u8; 8]

Source§

fn leading_zeros(&self) -> u8

Source§

fn trailing_zeros(&self) -> u8

Source§

fn count_ones(&self) -> u8

Implementors§