Crate gray_codes [] [src]

Gray code iterators and related utilities.

A Gray code is a reordering of the integers such that adjacent codes differ by exactly one bit.

The GrayCode{8,16,32,64} structs provide iterators over binary reflected Gray codes in various unsigned integer sizes as well as direct conversions to and from the codes. The Subsets struct provides a convenient way to iterate over subsets of a slice. The InclusionExclusion struct provides a building block for visiting all subsets more efficiently.

Structs

GrayCode8

Iterator over binary reflected Gray codes as u8 values

GrayCode16

Iterator over binary reflected Gray codes as u16 values

GrayCode32

Iterator over binary reflected Gray codes as u32 values

GrayCode64

Iterator over binary reflected Gray codes as u64 values

InclusionExclusion

Iterator yielding SetMutations that can be used to efficiently visit all subsets of n items

Subsets

Iterator yielding subsets of a slice

Enums

SetMutation

Set mutation operations.

Type Definitions

VecSubsets

Alias for iterating over Vec-valued subsets of a slice.