Macro fixt::fixturator [−][src]
macro_rules! fixturator { (with_vec $min : literal $max : literal ; $type : tt ; $($munch : tt) *) => { ... }; ($type : tt ; variants [$($variant : tt($variant_inner : ty)) *] ; $($munch : tt) *) => { ... }; ($type : tt ; unit variants [$($variant : tt) *] empty $empty : tt ; $($munch : tt) *) => { ... }; ($type : tt ; enum [$($variant : tt) *] ; $($munch : tt) *) => { ... }; ($type : ident ; from $from : ty ; $($munch : tt) *) => { ... }; ($type : ident ; constructor fn $fn : tt($($newtype : ty), *) ; $($munch : tt) *) => { ... }; ($type : ident ; vanilla fn $fn : tt($($newtype : ty), *) ; $($munch : tt) *) => { ... }; ($type : ident ; curve $curve : ident $e : expr ; $($munch : tt) *) => { ... }; ($type : ident ; $($munch : tt) *) => { ... }; ($type : ident, $empty : expr, $unpredictable : expr, $predictable : expr) => { ... }; }
Expand description
implements a FooFixturator for any type Foo
this simply wraps Fixturator<Foo, Curve> up as FooFixturator
this macro serves a few purposes:
- we avoid the orphan rule that would prevent us implementing Iterator on Fixturator directly
- we avoid the verbosity of type and impl juggling around every new FooFixturator
- we create a FooFixturator implementation that is compatible with basic_test! macro
- we cover all three basic curves
- we standardiize the new() and new_indexed() methods without relying on traits
the expressions passed into the macro are the body of the next calls for Empty, Unpredictable and Predictable, in order