pub const fn u8_as_u32(value: u8) -> u32Expand description
Losslessly converts a u8 into a u32.
This conversion is allowed as it is always lossless. Prefer this over the as
keyword to ensure no lossy casts are performed.
This is for use from a const context. For non const use, prefer the
FromSafeCast and IntoSafeCast traits.
ยงExamples
use kernel::num::casts;
assert_eq!(casts::u8_as_u32(1u8), 1u32);