summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadrieril2019-04-14 22:48:53 +0200
committerNadrieril2019-04-14 22:48:53 +0200
commit2e78bf6f5d7cf315aa1cc4fb7f828a6ee1f66b3f (patch)
tree55a78e492a62c3bd55835f1b4215d9d987c81dff
parentd29f163e03f170a06d700ff0f62a10a489d2f058 (diff)
improved_slice_patterns: use doc comments
Diffstat (limited to '')
-rw-r--r--improved_slice_patterns/src/lib.rs90
1 files changed, 45 insertions, 45 deletions
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<Option<usize>>
- * // z: Option<usize>
- * }
- * )
- * ```
- *
-*/
+/// 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<Option<usize>>
+/// // z: Option<usize>
+/// }
+/// )
+/// ```
+///
+///
#[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<Option<usize>>
- * // z: Option<usize>
- * }
- * [x, Some(0)] => {
- * // x: Option<usize>
- * },
- * [..] => { }
- * )
- * ```
- *
-*/
+/// 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<Option<usize>>
+/// // z: Option<usize>
+/// }
+/// [x, Some(0)] => {
+/// // x: Option<usize>
+/// },
+/// [..] => { }
+/// )
+/// ```
+///
+///
#[macro_export]
macro_rules! match_vec {
// Variable length pattern