Skip to content

Commit f97e0af

Browse files
committed
Add RangeInclusiveMap type
Uses RangeInclusive instead of Range as its keys. This requires a bit of fiddling around with extra trait bounds on the keys, because ranges can interact with each other by having one range's start exactly one away from another range's end. This requires use of the unstable Step trait (or some equivalent, which I've introduced here) _and_ the ability to know the max value of the key space, which I'm achieving using `num` for now. The latter may be possible to relax with some different trickery around the order of ranges we're comparing, and a different way of short-circuiting some loops. I'm going to experiment with that before committing to bringing in any extra dependency.
1 parent e8abc5f commit f97e0af

File tree

8 files changed

+876
-38
lines changed

8 files changed

+876
-38
lines changed

Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ categories = ["data-structures"]
1818
build = "build.rs"
1919

2020
[dependencies]
21+
# TODO: Make this an optional dependency based on default "rangeinclusive" feature.
22+
num = "0.3"
2123

2224
[build-dependencies]
2325
skeptic = { version = "0.13", optional = true }

build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#[cfg(feature="skeptic")]
1+
#[cfg(feature = "skeptic")]
22
extern crate skeptic;
33

44
fn main() {
55
// Generate doc tests for `README.md`.
6-
#[cfg(feature="skeptic")]
6+
#[cfg(feature = "skeptic")]
77
skeptic::generate_doc_tests(&["README.md"]);
88
}

0 commit comments

Comments
 (0)