From 2e78bf6f5d7cf315aa1cc4fb7f828a6ee1f66b3f Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 14 Apr 2019 22:48:53 +0200 Subject: improved_slice_patterns: use doc comments --- improved_slice_patterns/src/lib.rs | 90 +++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'improved_slice_patterns/src') diff --git a/improved_slice_patterns/src/lib.rs b/improved_slice_patterns/src/lib.rs index 0672499..1842599 100644 --- a/improved_slice_patterns/src/lib.rs +++ b/improved_slice_patterns/src/lib.rs @@ -1,27 +1,27 @@ #![feature(slice_patterns)] -/* Destructure an iterator using the syntax of slice_patterns. - * Wraps the match body in `Some` if there was a match; returns - * `None` otherwise. - * Contrary to slice_patterns, this allows moving out - * of the iterator. - * A variable length pattern (`x..`) is only allowed as the last - * pattern, unless the iterator is double-ended. - * - * Example: - * ``` - * let vec = vec![Some(1), Some(2), None]; - * - * destructure_iter!(vec.into_iter(); - * [Some(x), y.., z] => { - * // x: usize - * // y: impl Iterator> - * // z: Option - * } - * ) - * ``` - * -*/ +/// Destructure an iterator using the syntax of slice_patterns. +/// Wraps the match body in `Some` if there was a match; returns +/// `None` otherwise. +/// Contrary to slice_patterns, this allows moving out +/// of the iterator. +/// A variable length pattern (`x..`) is only allowed as the last +/// pattern, unless the iterator is double-ended. +/// +/// Example: +/// ``` +/// let vec = vec![Some(1), Some(2), None]; +/// +/// destructure_iter!(vec.into_iter(); +/// [Some(x), y.., z] => { +/// // x: usize +/// // y: impl Iterator> +/// // z: Option +/// } +/// ) +/// ``` +/// +/// #[macro_export] macro_rules! destructure_iter { // Variable length pattern @@ -108,29 +108,29 @@ macro_rules! destructure_iter { }; } -/* Pattern-match on a vec using the syntax of slice_patterns. - * Wraps the match body in `Some` if there was a match; returns - * `None` otherwise. - * A variable length pattern (`x..`) returns an iterator. - * - * Example: - * ``` - * let vec = vec![Some(1), Some(2), None]; - * - * match_vec!(vec; - * [Some(x), y.., z] => { - * // x: usize - * // y: impl Iterator> - * // z: Option - * } - * [x, Some(0)] => { - * // x: Option - * }, - * [..] => { } - * ) - * ``` - * -*/ +/// Pattern-match on a vec using the syntax of slice_patterns. +/// Wraps the match body in `Some` if there was a match; returns +/// `None` otherwise. +/// A variable length pattern (`x..`) returns an iterator. +/// +/// Example: +/// ``` +/// let vec = vec![Some(1), Some(2), None]; +/// +/// match_vec!(vec; +/// [Some(x), y.., z] => { +/// // x: usize +/// // y: impl Iterator> +/// // z: Option +/// } +/// [x, Some(0)] => { +/// // x: Option +/// }, +/// [..] => { } +/// ) +/// ``` +/// +/// #[macro_export] macro_rules! match_vec { // Variable length pattern -- cgit v1.2.3