diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-02-05 01:21:05 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-02-11 03:23:17 +0100 |
commit | 6b34e99b75f0b98cffa58d5e62051f11276ba820 (patch) | |
tree | ef07fc4e17538fc0d814aa71892d70355ce68825 /lib/etc | |
parent | 751ce5af1a515594f96bcbe6ad744a05e85f2680 (diff) |
Make doc comment test executable
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'lib/etc')
-rw-r--r-- | lib/etc/libimagutil/src/variants.rs | 31 |
1 files 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<A, B, C, F>(base: &A, modders: Vec<B>, f: &F) -> Vec<C> where |