1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use super::checks;

/// Helper trait for underlying primitives handling of bitfields.
///
/// # Note
///
/// Must not and cannot be implemented by dependencies.
#[doc(hidden)]
pub trait PushBits: checks::private::Sealed {
    fn push_bits(&mut self, amount: u32, bits: u8);
}

/// Helper trait for underlying primitives handling of bitfields.
///
/// # Note
///
/// Must not and cannot be implemented by dependencies.
#[doc(hidden)]
pub trait PopBits: checks::private::Sealed {
    fn pop_bits(&mut self, amount: u32) -> u8;
}

/// Trait implemented by primitives that drive bitfield manipulations generically.
#[doc(hidden)]
pub trait SpecifierBytes: checks::private::Sealed {
    /// The base type that the specifier is operating on.
    type Bytes;
}

pub trait IsU8Compatible: checks::private::Sealed {}
pub trait IsU16Compatible: checks::private::Sealed {}
pub trait IsU32Compatible: checks::private::Sealed {}
pub trait IsU64Compatible: checks::private::Sealed {}
pub trait IsU128Compatible: checks::private::Sealed {}

impl IsU8Compatible for [(); 8] {}
impl IsU16Compatible for [(); 16] {}
impl IsU32Compatible for [(); 32] {}
impl IsU64Compatible for [(); 64] {}
impl IsU128Compatible for [(); 128] {}