bit_combi_iter
bit_combi_iter is a small dependency-free crate to enumerate all bit combinations less than given unsigned integer value keeping the number of bits.
use BitCombinations;
Install
cargo add bit_combi_iter
API
BitCombinations<U> (U can be u8, u16, u32, u64, u128)
A struct implementing Iterator<Item=U>. Size of this struct is the same as size of U. No additional allocation is necessary.
BitCombinations::<U>::new(init: U) -> Self
new generates a BitCombinations instance initializing with state init.
BitCombinations::<U>::next(&mut self) -> Option<U>
next method generates a next bit combination of the current state. The generated value is always smaller than the next state.
License
Distributed under the MIT License.