summaryrefslogtreecommitdiff
path: root/improved_slice_patterns
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--improved_slice_patterns/Cargo.toml5
-rw-r--r--improved_slice_patterns/src/lib.rs7
2 files changed, 10 insertions, 2 deletions
diff --git a/improved_slice_patterns/Cargo.toml b/improved_slice_patterns/Cargo.toml
index 7bc6ca0..9c99e0d 100644
--- a/improved_slice_patterns/Cargo.toml
+++ b/improved_slice_patterns/Cargo.toml
@@ -1,9 +1,10 @@
[package]
name = "improved_slice_patterns"
-version = "1.0.0"
+version = "1.0.1" # remember to update html_root_url
authors = ["Nadrieril <nadrieril@users.noreply.github.com>"]
license = "MIT OR Apache-2.0"
edition = "2018"
description = "A tiny crate that provides macros to help matching on Vecs and iterators using the syntax of slice_patterns"
-repository = "https://github.com/Nadrieril/dhall-rust"
readme = "README.md"
+repository = "https://github.com/Nadrieril/dhall-rust"
+documentation = "https://docs.rs/improved_slice_patterns/"
diff --git a/improved_slice_patterns/src/lib.rs b/improved_slice_patterns/src/lib.rs
index 3fdd9c9..3e459bb 100644
--- a/improved_slice_patterns/src/lib.rs
+++ b/improved_slice_patterns/src/lib.rs
@@ -1,4 +1,5 @@
#![feature(slice_patterns)]
+#![doc(html_root_url = "https://docs.rs/improved_slice_patterns/1.0.1")]
//! A tiny crate that provides two macros to help matching
//! on `Vec`s and iterators using the syntax of
@@ -7,10 +8,13 @@
//! [slice_patterns]: https://doc.rust-lang.org/nightly/unstable-book/language-features/slice-patterns.html
/// 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.
///
@@ -122,10 +126,13 @@ 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.
+///
/// Contrary to slice_patterns, this allows moving out
/// of the `Vec`.
+///
/// A variable length pattern (`x..`) returns an iterator.
///
/// Example: