devela::all

Trait BitSized

Source
pub trait BitSized<const LEN: usize>: ByteSized {
    const BIT_SIZE: usize = _;
    const MIN_BYTE_SIZE: usize = _;

    // Provided methods
    fn bit_size(&self) -> usize  { ... }
    fn min_byte_size(&self) -> usize  { ... }
}
Expand description

Type size information in bits.

Indicates a size of exactly LEN bits for the relevant data part of this type.

E.g. a bool has a BitSized of 1 bit.

Provided Associated Constants§

Source

const BIT_SIZE: usize = _

The bit size of this type (only the relevant data part, without padding).

§Panics

Panics if MIN_BYTE_SIZE > BYTE_SIZE,

Source

const MIN_BYTE_SIZE: usize = _

The rounded up byte size for this type.

This is the minimum number of full bytes needed to represent this type. Basically (LEN + 7) / 8.

§Panics

Panics if MIN_BYTE_SIZE > BYTE_SIZE,

Provided Methods§

Source

fn bit_size(&self) -> usize

Returns the bit size of this type (only the relevant data part, without padding).

§Panics

Panics if MIN_BYTE_SIZE > BYTE_SIZE,

Source

fn min_byte_size(&self) -> usize

Returns the rounded up byte size for this type.

This is the minimum number of full bytes needed to represent this type. Basically (LEN + 7) / 8.

§Panics

Panics if MIN_BYTE_SIZE > BYTE_SIZE,

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<0> for ()

Source§

impl BitSized<1> for bool

Source§

impl BitSized<8> for i8

Source§

impl BitSized<8> for u8

Source§

impl BitSized<16> for i16

Source§

impl BitSized<16> for u16

Source§

impl BitSized<32> for char

Source§

impl BitSized<32> for f32

Source§

impl BitSized<32> for i32

Source§

impl BitSized<32> for u32

Source§

impl BitSized<64> for f64

Source§

impl BitSized<64> for i64

Source§

impl BitSized<64> for isize

Source§

impl BitSized<64> for u64

Source§

impl BitSized<64> for usize

Source§

impl BitSized<128> for i128

Source§

impl BitSized<128> for u128

Source§

impl BitSized<{$PTR_BITS * 2}> for &str

Source§

impl<T> BitSized<{$PTR_BITS * 2}> for &[T]

Source§

impl<T> BitSized<{$PTR_BITS * 2}> for &mut [T]

Source§

impl<T: BitSized<8>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<8>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<8>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<8>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<8>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<16>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<16>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<16>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<16>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<16>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<24>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<24>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<24>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<24>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<24>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<32>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<32>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<32>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<32>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<32>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<40>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<40>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<40>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<40>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<40>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<48>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<48>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<48>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<48>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<48>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<56>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<56>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<56>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<56>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<56>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<64>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<64>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<64>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<64>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<64>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<72>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<72>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<72>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<72>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<72>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<80>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<80>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<80>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<80>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<80>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<88>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<88>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<88>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<88>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<88>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<96>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<96>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<96>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<96>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<96>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<104>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<104>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<104>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<104>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<104>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<112>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<112>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<112>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<112>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<112>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<120>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<120>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<120>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<120>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<120>> BitSized<{$bits*$len}> for [T; 16]

Source§

impl<T: BitSized<128>> BitSized<{$bits*$len}> for [T; 1]

Source§

impl<T: BitSized<128>> BitSized<{$bits*$len}> for [T; 2]

Source§

impl<T: BitSized<128>> BitSized<{$bits*$len}> for [T; 4]

Source§

impl<T: BitSized<128>> BitSized<{$bits*$len}> for [T; 8]

Source§

impl<T: BitSized<128>> BitSized<{$bits*$len}> for [T; 16]

Implementors§

Source§

impl BitSized<0> for Infallible

Source§

impl BitSized<0> for PhantomPinned

Source§

impl BitSized<1> for AtomicBool

Source§

impl BitSized<7> for AsciiChar

Source§

impl BitSized<7> for char7

Source§

impl BitSized<8> for Ordering

Source§

impl BitSized<8> for AtomicOrdering

Source§

impl BitSized<8> for char8

Source§

impl BitSized<8> for AtomicI8

Source§

impl BitSized<8> for AtomicU8

Source§

impl BitSized<8> for NonZeroI8

Source§

impl BitSized<8> for NonZeroU8

Source§

impl BitSized<16> for char16

Source§

impl BitSized<16> for AtomicI16

Source§

impl BitSized<16> for AtomicU16

Source§

impl BitSized<16> for NonZeroI16

Source§

impl BitSized<16> for NonZeroU16

Source§

impl BitSized<32> for AtomicF32

Source§

impl BitSized<32> for AtomicI32

Source§

impl BitSized<32> for AtomicU32

Source§

impl BitSized<32> for NonZeroI32

Source§

impl BitSized<32> for NonZeroU32

Source§

impl BitSized<64> for AtomicF64

Source§

impl BitSized<64> for AtomicI64

Source§

impl BitSized<64> for AtomicIsize

Source§

impl BitSized<64> for AtomicU64

Source§

impl BitSized<64> for AtomicUsize

Source§

impl BitSized<64> for NonZeroI64

Source§

impl BitSized<64> for NonZeroIsize

Source§

impl BitSized<64> for NonZeroU64

Source§

impl BitSized<64> for NonZeroUsize

Source§

impl BitSized<128> for Duration

Source§

impl BitSized<128> for SystemInstant

Source§

impl BitSized<128> for SystemTime

Source§

impl BitSized<128> for AtomicI128

Source§

impl BitSized<128> for AtomicU128

Source§

impl BitSized<128> for NonZeroI128

Source§

impl BitSized<128> for NonZeroU128

Source§

impl BitSized<{$PTR_BITS * 3}> for GraphemeString

Source§

impl BitSized<{$PTR_BITS * 3}> for String

Source§

impl<K, V> BitSized<{$PTR_BITS * 3}> for BTreeMap<K, V>

Source§

impl<K, V> BitSized<{$PTR_BITS * 3}> for HashMap<K, V>

Source§

impl<T> BitSized<0> for PhantomData<T>

Source§

impl<T> BitSized<64> for AtomicPtr<T>

Source§

impl<T> BitSized<{$PTR_BITS * 1}> for Arc<T>

Source§

impl<T> BitSized<{$PTR_BITS * 1}> for Rc<T>

Source§

impl<T> BitSized<{$PTR_BITS * 3}> for Mutex<T>

Source§

impl<T> BitSized<{$PTR_BITS * 3}> for BTreeSet<T>

Source§

impl<T> BitSized<{$PTR_BITS * 3}> for BinaryHeap<T>

Source§

impl<T> BitSized<{$PTR_BITS * 3}> for HashSet<T>

Source§

impl<T> BitSized<{$PTR_BITS * 3}> for LinkedList<T>

Source§

impl<T> BitSized<{$PTR_BITS * 3}> for Vec<T>

Source§

impl<T> BitSized<{$PTR_BITS * 3}> for VecDeque<T>

Source§

impl<T, const LEN: usize> BitSized<LEN> for TypeResource<T>
where T: TypeResourced, T::TypeData: BitSized<LEN>,

Source§

impl<T: BitSized<LEN>, const LEN: usize> BitSized<LEN> for BareBox<T>

Source§

impl<const LEN: usize> BitSized<LEN> for GraphemeNonul<LEN>

Source§

impl<const LEN: usize> BitSized<LEN> for StringNonul<LEN>

Source§

impl<const V: i8> BitSized<{$IP::BYTE_SIZE * 8}> for devela::_info::examples::niche::NonValueI8<V>

Available on doc only.
Source§

impl<const V: i8> BitSized<{$IP::BYTE_SIZE * 8}> for devela::all::NonValueI8<V>

Source§

impl<const V: u8> BitSized<{$IP::BYTE_SIZE * 8}> for NonValueU8<V>

Source§

impl<const V: u16> BitSized<{$IP::BYTE_SIZE * 8}> for NonValueU16<V>