Repeat!() { /* proc-macro */ }
Expand description

Make a Generator that recycles a collection of values.

The main advantage of this macro, over using Repeat directly, is that it will coerce the types of the arguments. This can make declarations much (much) more succinct when strings are involved.

Example:

use boulder::{Generatable, Generator, Repeat};

#[derive(Generatable)]
struct Foo {
   #[boulder(generator=Repeat!("hi", "bye"))]
   a: String
}

let mut g = Foo::generator();
assert_eq!(g.generate().a, "hi");
assert_eq!(g.generate().a, "bye");