Bitsized

Trait 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 Constants§

Required Associated Types§

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 Bitsized for bool

Handle bool as a u1

Source§

const BITS: usize = 1usize

Source§

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

Source§

type ArbitraryInt = UInt<u8, 1>

Source§

impl Bitsized for i8

Source§

const BITS: usize = 8usize

Source§

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

Source§

type ArbitraryInt = i8

Source§

impl Bitsized for i16

Source§

const BITS: usize = 16usize

Source§

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

Source§

type ArbitraryInt = i16

Source§

impl Bitsized for i32

Source§

const BITS: usize = 32usize

Source§

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

Source§

type ArbitraryInt = i32

Source§

impl Bitsized for i64

Source§

const BITS: usize = 64usize

Source§

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

Source§

type ArbitraryInt = i64

Source§

impl Bitsized for i128

Source§

const BITS: usize = 128usize

Source§

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

Source§

type ArbitraryInt = i128

Source§

impl Bitsized for u8

Source§

const BITS: usize = 8usize

Source§

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

Source§

type ArbitraryInt = u8

Source§

impl Bitsized for u16

Source§

const BITS: usize = 16usize

Source§

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

Source§

type ArbitraryInt = u16

Source§

impl Bitsized for u32

Source§

const BITS: usize = 32usize

Source§

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

Source§

type ArbitraryInt = u32

Source§

impl Bitsized for u64

Source§

const BITS: usize = 64usize

Source§

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

Source§

type ArbitraryInt = u64

Source§

impl Bitsized for u128

Source§

const BITS: usize = 128usize

Source§

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

Source§

type ArbitraryInt = u128

Source§

impl<BaseType, const BITS: usize> Bitsized for Int<BaseType, BITS>
where BaseType: SignedInteger + BuiltinInteger, Int<BaseType, BITS>: SignedInteger,

Source§

const BITS: usize = BITS

Source§

const MAX: Self::ArbitraryInt = <Self as arbitrary_int::traits::Integer>::MAX

Source§

type ArbitraryInt = Int<BaseType, BITS>

Source§

impl<BaseType, const BITS: usize> Bitsized for UInt<BaseType, BITS>
where BaseType: UnsignedInteger + BuiltinInteger, UInt<BaseType, BITS>: UnsignedInteger,

Only basing this on Integer did not work, as bool and others are not Integer. 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 Integer and Bitsized would be good as well.

Source§

const BITS: usize = BITS

Source§

const MAX: Self::ArbitraryInt = <Self as arbitrary_int::traits::Integer>::MAX

Source§

type ArbitraryInt = UInt<BaseType, BITS>

Implementors§