Trait BitCount

Source
pub unsafe trait BitCount {
    const COUNT: usize;
}
Expand description

A trait which defines how many bits are needed to store a struct.

§Safety

Define Num as {i,u}{8,16,32,64,128}.

  • when calling core::mem::transmute on Self, only bits [0, COUNT) can be non-zero
  • TryFrom<Num> produces Some(x) <=> core::mem::transmute(num) produces a valid Self(x)
  • TryFrom<Num> produces None <=> core::mem::transmute(num) produces an invalid state for Self

Required Associated Constants§

Source

const COUNT: usize

The number of bits associated with this 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 BitCount for bool

Source§

const COUNT: usize = 1usize

Source§

impl BitCount for u8

Source§

const COUNT: usize = 8usize

Source§

impl BitCount for u16

Source§

const COUNT: usize = 16usize

Source§

impl BitCount for u32

Source§

const COUNT: usize = 32usize

Source§

impl BitCount for u64

Source§

const COUNT: usize = 64usize

Source§

impl BitCount for u128

Source§

const COUNT: usize = 128usize

Implementors§

Source§

impl BitCount for i2

Source§

const COUNT: usize = 2usize

Source§

impl BitCount for i3

Source§

const COUNT: usize = 3usize

Source§

impl BitCount for i4

Source§

const COUNT: usize = 4usize

Source§

impl BitCount for i5

Source§

const COUNT: usize = 5usize

Source§

impl BitCount for i6

Source§

const COUNT: usize = 6usize

Source§

impl BitCount for i7

Source§

const COUNT: usize = 7usize

Source§

impl BitCount for i9

Source§

const COUNT: usize = 9usize

Source§

impl BitCount for i10

Source§

const COUNT: usize = 10usize

Source§

impl BitCount for i11

Source§

const COUNT: usize = 11usize

Source§

impl BitCount for i12

Source§

const COUNT: usize = 12usize

Source§

impl BitCount for i13

Source§

const COUNT: usize = 13usize

Source§

impl BitCount for i14

Source§

const COUNT: usize = 14usize

Source§

impl BitCount for i15

Source§

const COUNT: usize = 15usize

Source§

impl BitCount for i17

Source§

const COUNT: usize = 17usize

Source§

impl BitCount for i18

Source§

const COUNT: usize = 18usize

Source§

impl BitCount for i19

Source§

const COUNT: usize = 19usize

Source§

impl BitCount for i20

Source§

const COUNT: usize = 20usize

Source§

impl BitCount for i21

Source§

const COUNT: usize = 21usize

Source§

impl BitCount for i22

Source§

const COUNT: usize = 22usize

Source§

impl BitCount for i23

Source§

const COUNT: usize = 23usize

Source§

impl BitCount for i24

Source§

const COUNT: usize = 24usize

Source§

impl BitCount for i25

Source§

const COUNT: usize = 25usize

Source§

impl BitCount for i26

Source§

const COUNT: usize = 26usize

Source§

impl BitCount for i27

Source§

const COUNT: usize = 27usize

Source§

impl BitCount for i28

Source§

const COUNT: usize = 28usize

Source§

impl BitCount for i29

Source§

const COUNT: usize = 29usize

Source§

impl BitCount for i30

Source§

const COUNT: usize = 30usize

Source§

impl BitCount for i31

Source§

const COUNT: usize = 31usize

Source§

impl BitCount for i33

Source§

const COUNT: usize = 33usize

Source§

impl BitCount for i34

Source§

const COUNT: usize = 34usize

Source§

impl BitCount for i35

Source§

const COUNT: usize = 35usize

Source§

impl BitCount for i36

Source§

const COUNT: usize = 36usize

Source§

impl BitCount for i37

Source§

const COUNT: usize = 37usize

Source§

impl BitCount for i38

Source§

const COUNT: usize = 38usize

Source§

impl BitCount for i39

Source§

const COUNT: usize = 39usize

Source§

impl BitCount for i40

Source§

const COUNT: usize = 40usize

Source§

impl BitCount for i41

Source§

const COUNT: usize = 41usize

Source§

impl BitCount for i42

Source§

const COUNT: usize = 42usize

Source§

impl BitCount for i43

Source§

const COUNT: usize = 43usize

Source§

impl BitCount for i44

Source§

const COUNT: usize = 44usize

Source§

impl BitCount for i45

Source§

const COUNT: usize = 45usize

Source§

impl BitCount for i46

Source§

const COUNT: usize = 46usize

Source§

impl BitCount for i47

Source§

const COUNT: usize = 47usize

Source§

impl BitCount for i48

Source§

const COUNT: usize = 48usize

Source§

impl BitCount for i49

Source§

const COUNT: usize = 49usize

Source§

impl BitCount for i50

Source§

const COUNT: usize = 50usize

Source§

impl BitCount for i51

Source§

const COUNT: usize = 51usize

Source§

impl BitCount for i52

Source§

const COUNT: usize = 52usize

Source§

impl BitCount for i53

Source§

const COUNT: usize = 53usize

Source§

impl BitCount for i54

Source§

const COUNT: usize = 54usize

Source§

impl BitCount for i55

Source§

const COUNT: usize = 55usize

Source§

impl BitCount for i56

Source§

const COUNT: usize = 56usize

Source§

impl BitCount for i57

Source§

const COUNT: usize = 57usize

Source§

impl BitCount for i58

Source§

const COUNT: usize = 58usize

Source§

impl BitCount for i59

Source§

const COUNT: usize = 59usize

Source§

impl BitCount for i60

Source§

const COUNT: usize = 60usize

Source§

impl BitCount for i61

Source§

const COUNT: usize = 61usize

Source§

impl BitCount for i62

Source§

const COUNT: usize = 62usize

Source§

impl BitCount for i63

Source§

const COUNT: usize = 63usize

Source§

impl BitCount for u1

Source§

const COUNT: usize = 1usize

Source§

impl BitCount for u2

Source§

const COUNT: usize = 2usize

Source§

impl BitCount for u3

Source§

const COUNT: usize = 3usize

Source§

impl BitCount for u4

Source§

const COUNT: usize = 4usize

Source§

impl BitCount for u5

Source§

const COUNT: usize = 5usize

Source§

impl BitCount for u6

Source§

const COUNT: usize = 6usize

Source§

impl BitCount for u7

Source§

const COUNT: usize = 7usize

Source§

impl BitCount for u9

Source§

const COUNT: usize = 9usize

Source§

impl BitCount for u10

Source§

const COUNT: usize = 10usize

Source§

impl BitCount for u11

Source§

const COUNT: usize = 11usize

Source§

impl BitCount for u12

Source§

const COUNT: usize = 12usize

Source§

impl BitCount for u13

Source§

const COUNT: usize = 13usize

Source§

impl BitCount for u14

Source§

const COUNT: usize = 14usize

Source§

impl BitCount for u15

Source§

const COUNT: usize = 15usize

Source§

impl BitCount for u17

Source§

const COUNT: usize = 17usize

Source§

impl BitCount for u18

Source§

const COUNT: usize = 18usize

Source§

impl BitCount for u19

Source§

const COUNT: usize = 19usize

Source§

impl BitCount for u20

Source§

const COUNT: usize = 20usize

Source§

impl BitCount for u21

Source§

const COUNT: usize = 21usize

Source§

impl BitCount for u22

Source§

const COUNT: usize = 22usize

Source§

impl BitCount for u23

Source§

const COUNT: usize = 23usize

Source§

impl BitCount for u24

Source§

const COUNT: usize = 24usize

Source§

impl BitCount for u25

Source§

const COUNT: usize = 25usize

Source§

impl BitCount for u26

Source§

const COUNT: usize = 26usize

Source§

impl BitCount for u27

Source§

const COUNT: usize = 27usize

Source§

impl BitCount for u28

Source§

const COUNT: usize = 28usize

Source§

impl BitCount for u29

Source§

const COUNT: usize = 29usize

Source§

impl BitCount for u30

Source§

const COUNT: usize = 30usize

Source§

impl BitCount for u31

Source§

const COUNT: usize = 31usize

Source§

impl BitCount for u33

Source§

const COUNT: usize = 33usize

Source§

impl BitCount for u34

Source§

const COUNT: usize = 34usize

Source§

impl BitCount for u35

Source§

const COUNT: usize = 35usize

Source§

impl BitCount for u36

Source§

const COUNT: usize = 36usize

Source§

impl BitCount for u37

Source§

const COUNT: usize = 37usize

Source§

impl BitCount for u38

Source§

const COUNT: usize = 38usize

Source§

impl BitCount for u39

Source§

const COUNT: usize = 39usize

Source§

impl BitCount for u40

Source§

const COUNT: usize = 40usize

Source§

impl BitCount for u41

Source§

const COUNT: usize = 41usize

Source§

impl BitCount for u42

Source§

const COUNT: usize = 42usize

Source§

impl BitCount for u43

Source§

const COUNT: usize = 43usize

Source§

impl BitCount for u44

Source§

const COUNT: usize = 44usize

Source§

impl BitCount for u45

Source§

const COUNT: usize = 45usize

Source§

impl BitCount for u46

Source§

const COUNT: usize = 46usize

Source§

impl BitCount for u47

Source§

const COUNT: usize = 47usize

Source§

impl BitCount for u48

Source§

const COUNT: usize = 48usize

Source§

impl BitCount for u49

Source§

const COUNT: usize = 49usize

Source§

impl BitCount for u50

Source§

const COUNT: usize = 50usize

Source§

impl BitCount for u51

Source§

const COUNT: usize = 51usize

Source§

impl BitCount for u52

Source§

const COUNT: usize = 52usize

Source§

impl BitCount for u53

Source§

const COUNT: usize = 53usize

Source§

impl BitCount for u54

Source§

const COUNT: usize = 54usize

Source§

impl BitCount for u55

Source§

const COUNT: usize = 55usize

Source§

impl BitCount for u56

Source§

const COUNT: usize = 56usize

Source§

impl BitCount for u57

Source§

const COUNT: usize = 57usize

Source§

impl BitCount for u58

Source§

const COUNT: usize = 58usize

Source§

impl BitCount for u59

Source§

const COUNT: usize = 59usize

Source§

impl BitCount for u60

Source§

const COUNT: usize = 60usize

Source§

impl BitCount for u61

Source§

const COUNT: usize = 61usize

Source§

impl BitCount for u62

Source§

const COUNT: usize = 62usize

Source§

impl BitCount for u63

Source§

const COUNT: usize = 63usize