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

Object Safety§

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§