Make doc comment test executable

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-02-05 01:21:05 +01:00
parent 751ce5af1a
commit 6b34e99b75

View file

@ -17,21 +17,22 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// //
/** ///
* Generate variants of a base value by applying parts /// Generate variants of a base value by applying parts
* ///
* Example: /// Example:
* ///
* ```ignore /// ```
* generate_variants(path, vec!["foo", "bar", "baz"], |b, v| { /// let base = "Base";
* let b = b.clone(); /// let variants = generate_variants(base, vec!["foo", "bar", "baz"], |base, modder| {
* b.push(v); /// let mut variant = base.clone();
* b /// variant.push(modder);
* }) /// variant
* /// });
* ``` ///
* /// assert!(variants, vec!["Basefoo", "Basebar", "Basebaz"]);
*/ /// ```
///
pub fn generate_variants<A, B, C, F>(base: &A, modders: Vec<B>, f: &F) pub fn generate_variants<A, B, C, F>(base: &A, modders: Vec<B>, f: &F)
-> Vec<C> -> Vec<C>
where where