Macro smallnum::small_unsigned [−][src]
macro_rules! small_unsigned {
($max : expr $(,) ?) => { ... };
}
Expand description
Return smallest unsigned type capable of representing input value (positive, i.e. maximum).
Example
use smallnum::{small_unsigned, SmallUnsigned};
use core::mem::size_of_val;
let idx: usize = 5;
let small_idx: small_unsigned!(500) = 5;
assert_eq!(idx, small_idx.usize());
assert!(size_of_val(&idx) > size_of_val(&small_idx));