pub const fn count(n: usize) -> Option<usize>Expand description
Returns Some with the number of combinations that n variables produces.
Returns None if n variables would produce more than what can be represented.
1variable produces2combinations2variables produces4combinations3variables produces8combinations4variables produces16combinationsMAXvariables producescount(MAX)combinations
Use is_supported(n) or count(n).is_some()
to check if n variables is supported.
15variables is supported on 16-bit targets31variables is supported on 32-bit targets63variables is supported on 64-bit targets
See warning notice in crate root.
ยงExample
assert_eq!(count(0), Some(0));
assert_eq!(count(1), Some(2));
assert_eq!(count(2), Some(4));
assert_eq!(count(3), Some(8));
assert_eq!(count(4), Some(16));
assert_eq!(count(5), Some(32));
assert_eq!(count(6), Some(64));
assert_eq!(count(7), Some(128));
assert_eq!(count(8), Some(256));
assert_eq!(count(9), Some(512));
assert_eq!(count(10), Some(1024));
assert_eq!(count(11), Some(2048));
assert_eq!(count(12), Some(4096));
assert_eq!(count(13), Some(8192));
assert_eq!(count(14), Some(16384));
assert_eq!(count(100), None);