Trait tock_registers::UIntLike
source · [−]pub trait UIntLike: BitAnd<Output = Self> + BitOr<Output = Self> + BitOrAssign + Not<Output = Self> + Eq + Shr<usize, Output = Self> + Shl<usize, Output = Self> + Copy + Clone {
fn zero() -> Self;
}
Expand description
Trait representing the base type of registers.
UIntLike defines basic properties of types required to read/write/modify a register through its methods and supertrait requirements.
It features a range of default implementations for common unsigned
integer types, such as u8
, u16
, u32
, u64
, u128
,
and usize
.
Required Methods
Return the representation of the value 0
in the implementing
type.
This can be used to acquire values of the UIntLike
type,
even in generic implementations. For instance, to get the
value 1
, one can use <T as UIntLike>::zero() + 1
. To get
the largest representable value, use a bitwise negation: ~(<T as UIntLike>::zero())
.