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