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§
Sourcefn zero() -> Self
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.