use crate::{DomainComponents, WordlistIterator};
pub fn permute_words_transform<'domain>(
domain_components: &'domain DomainComponents,
words: WordlistIterator<'domain>,
) -> impl Iterator<Item = String> + 'domain {
words
.flat_map(move |word| {
(0 .. domain_components.count()).map(move |idx| {
let domain_elems = domain_components.all();
let augmented_domain_components: Vec<&str> = [
&domain_elems[.. idx],
[*word].as_slice(),
&domain_elems[idx ..]
].concat();
augmented_domain_components.join(".")
})
})
}