pub fn bits<const N: usize>(x: LiteralType) -> Bits<N>
Expand description
Convenience function to construct Bits from an unsigned literal Sometimes, you know you will be working with a value that is smaller than 128 bits (the current maximum sized built-in unsigned integer in Rust). In those cases, the bits function can make construction slightly simpler.
let x : Bits<14> = bits(0xDEA);
assert_eq!("0dea", format!("{:x}", x))
In most cases, it’s easier to use into
:
let x: Bits<14> = 0xDEA.into();
assert_eq!("0dea", format!("{:x}", x))