From 6b34e99b75f0b98cffa58d5e62051f11276ba820 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 5 Feb 2019 01:21:05 +0100 Subject: [PATCH] Make doc comment test executable Signed-off-by: Matthias Beyer --- lib/etc/libimagutil/src/variants.rs | 31 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/etc/libimagutil/src/variants.rs b/lib/etc/libimagutil/src/variants.rs index 47f6d349..9775caf5 100644 --- a/lib/etc/libimagutil/src/variants.rs +++ b/lib/etc/libimagutil/src/variants.rs @@ -17,21 +17,22 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // -/** - * Generate variants of a base value by applying parts - * - * Example: - * - * ```ignore - * generate_variants(path, vec!["foo", "bar", "baz"], |b, v| { - * let b = b.clone(); - * b.push(v); - * b - * }) - * - * ``` - * - */ +/// +/// Generate variants of a base value by applying parts +/// +/// Example: +/// +/// ``` +/// let base = "Base"; +/// let variants = generate_variants(base, vec!["foo", "bar", "baz"], |base, modder| { +/// let mut variant = base.clone(); +/// variant.push(modder); +/// variant +/// }); +/// +/// assert!(variants, vec!["Basefoo", "Basebar", "Basebaz"]); +/// ``` +/// pub fn generate_variants(base: &A, modders: Vec, f: &F) -> Vec where