Trait bilge::Bitsized

source ·
pub trait Bitsized {
    type ArbitraryInt;

    const BITS: usize;
    const MAX: Self::ArbitraryInt;
}
Expand description

This is internally used, but might be useful. No guarantees are given (for now).

Required Associated Types§

Required Associated Constants§

Implementations on Foreign Types§

source§

impl Bitsized for u32

§

type ArbitraryInt = u32

source§

const BITS: usize = 32usize

source§

const MAX: Self::ArbitraryInt = {transmute(0xffffffff): <u32 as Bitsized>::ArbitraryInt}

source§

impl Bitsized for u8

§

type ArbitraryInt = u8

source§

const BITS: usize = 8usize

source§

const MAX: Self::ArbitraryInt = {transmute(0xff): <u8 as Bitsized>::ArbitraryInt}

source§

impl<BaseType, const BITS: usize> Bitsized for UInt<BaseType, BITS>where UInt<BaseType, BITS>: Number,

Only basing this on Number did not work, as bool and others are not Number. We could remove the whole macro_rules thing if it worked, though. Maybe there is some way to do this, I’m not deep into types. Finding some way to combine Number and Bitsized would be good as well.

§

type ArbitraryInt = UInt<BaseType, BITS>

source§

const BITS: usize = BITS

source§

const MAX: Self::ArbitraryInt = <Self as arbitrary_int::Number>::MAX

source§

impl Bitsized for u16

§

type ArbitraryInt = u16

source§

const BITS: usize = 16usize

source§

const MAX: Self::ArbitraryInt = {transmute(0xffff): <u16 as Bitsized>::ArbitraryInt}

source§

impl Bitsized for bool

Handle bool as a u1

§

type ArbitraryInt = UInt<u8, 1>

source§

const BITS: usize = 1usize

source§

const MAX: Self::ArbitraryInt = {transmute(0x01): <bool as Bitsized>::ArbitraryInt}

source§

impl Bitsized for u64

§

type ArbitraryInt = u64

source§

const BITS: usize = 64usize

source§

const MAX: Self::ArbitraryInt = {transmute(0xffffffffffffffff): <u64 as Bitsized>::ArbitraryInt}

source§

impl Bitsized for u128

§

type ArbitraryInt = u128

source§

const BITS: usize = 128usize

source§

const MAX: Self::ArbitraryInt = {transmute(0xffffffffffffffffffffffffffffffff): <u128 as Bitsized>::ArbitraryInt}

Implementors§