tock_registers

Trait 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
    + Debug {
    // Required method
    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§

Source

fn zero() -> Self

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()).

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 UIntLike for u8

Source§

fn zero() -> Self

Source§

impl UIntLike for u16

Source§

fn zero() -> Self

Source§

impl UIntLike for u32

Source§

fn zero() -> Self

Source§

impl UIntLike for u64

Source§

fn zero() -> Self

Source§

impl UIntLike for u128

Source§

fn zero() -> Self

Source§

impl UIntLike for usize

Source§

fn zero() -> Self

Implementors§