T::BITS
RS-W1132All integer types provide the size of the type in bits through T::BITS
.
Consider using this instead of manually calling std::mem::size_of::<T>()
and multiplying the result by 8.
fn foo() {
let usize_bits = std::mem::size_of::<usize>() * 8;
let u32_bits = std::mem::size_of::<u32>() * 8;
}
fn foo() {
let usize_bits = usize::BITS as usize;
let u32_bits = u32::BITS as usize;
}