Trait arbitrary_int::Number

source ·
pub trait Number: Sized {
    type UnderlyingType: Debug + From<u8> + TryFrom<u16> + TryFrom<u32> + TryFrom<u64> + TryFrom<u128>;

    const BITS: usize;
    const MIN: Self;
    const MAX: Self;

    // Required methods
    fn new(value: Self::UnderlyingType) -> Self;
    fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>;
    fn value(self) -> Self::UnderlyingType;
}

Required Associated Types§

Required Associated Constants§

source

const BITS: usize

Number of bits that can fit in this type

source

const MIN: Self

Minimum value that can be represented by this type

source

const MAX: Self

Maximum value that can be represented by this type

Required Methods§

source

fn new(value: Self::UnderlyingType) -> Self

source

fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>

source

fn value(self) -> Self::UnderlyingType

Implementations on Foreign Types§

source§

impl Number for u8

§

type UnderlyingType = u8

source§

const BITS: usize = 8usize

source§

const MIN: Self = 0u8

source§

const MAX: Self = 255u8

source§

fn new(value: Self::UnderlyingType) -> Self

source§

fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>

source§

fn value(self) -> Self::UnderlyingType

source§

impl Number for u64

§

type UnderlyingType = u64

source§

const BITS: usize = 64usize

source§

const MIN: Self = 0u64

source§

const MAX: Self = 18_446_744_073_709_551_615u64

source§

fn new(value: Self::UnderlyingType) -> Self

source§

fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>

source§

fn value(self) -> Self::UnderlyingType

source§

impl Number for u32

§

type UnderlyingType = u32

source§

const BITS: usize = 32usize

source§

const MIN: Self = 0u32

source§

const MAX: Self = 4_294_967_295u32

source§

fn new(value: Self::UnderlyingType) -> Self

source§

fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>

source§

fn value(self) -> Self::UnderlyingType

source§

impl Number for u128

§

type UnderlyingType = u128

source§

const BITS: usize = 128usize

source§

const MIN: Self = 0u128

source§

const MAX: Self = 340_282_366_920_938_463_463_374_607_431_768_211_455u128

source§

fn new(value: Self::UnderlyingType) -> Self

source§

fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>

source§

fn value(self) -> Self::UnderlyingType

source§

impl Number for u16

§

type UnderlyingType = u16

source§

const BITS: usize = 16usize

source§

const MIN: Self = 0u16

source§

const MAX: Self = 65_535u16

source§

fn new(value: Self::UnderlyingType) -> Self

source§

fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>

source§

fn value(self) -> Self::UnderlyingType

Implementors§

source§

impl<const BITS: usize> Number for UInt<u8, BITS>

§

type UnderlyingType = u8

source§

const BITS: usize = BITS

source§

const MIN: Self = _

source§

const MAX: Self = _

source§

impl<const BITS: usize> Number for UInt<u16, BITS>

§

type UnderlyingType = u16

source§

const BITS: usize = BITS

source§

const MIN: Self = _

source§

const MAX: Self = _

source§

impl<const BITS: usize> Number for UInt<u32, BITS>

§

type UnderlyingType = u32

source§

const BITS: usize = BITS

source§

const MIN: Self = _

source§

const MAX: Self = _

source§

impl<const BITS: usize> Number for UInt<u64, BITS>

§

type UnderlyingType = u64

source§

const BITS: usize = BITS

source§

const MIN: Self = _

source§

const MAX: Self = _

source§

impl<const BITS: usize> Number for UInt<u128, BITS>

§

type UnderlyingType = u128

source§

const BITS: usize = BITS

source§

const MIN: Self = _

source§

const MAX: Self = _