pub const fn u32_as_usize(value: u32) -> usizeExpand description
Losslessly converts a u32 into a usize.
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::u32_as_usize(1u32), 1usize);