>>605
もちろんcollect()を外せばそのままイテレータを返すイテレータを返す関数になる

fn subsets<T>(input: &[T]) -> impl Iterator<Item=impl Iterator<Item=&T>> {
let len = input.len();
(0..(1 << len))
.map(move |bits| (0..len)
.filter(move |index| bits & (1 << index) != 0)
.map(|index| &input[index]))
}