Skip to content

Commit 7effab7

Browse files
committed
Use explicit version numbers, some Markdown fixes
1 parent 929af53 commit 7effab7

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# rust-iterators
2+
23
Demonstrates basic Rust iterator use.
34

45
[![Build Status](https://travis-ci.org/rustomax/rust-iterators.svg?branch=master)](https://travis-ci.org/rustomax/rust-iterators)
@@ -14,9 +15,11 @@ git clone https://github.com/rustomax/rust-iterators.git
1415
cd rust-iterators/
1516
cargo run
1617
```
18+
1719
> Certain features (`step_by()` and inclusive range) require `nightly` compiler. If you are on `stable`, in order to compile the examples, you have to comment out relevant code sections.
1820
1921
## Contents
22+
2023
- [Introduction](#introduction)
2124
- [Basic Ranges](#basic-ranges)
2225
- [Digging Deeper](#digging-deeper)
@@ -236,9 +239,9 @@ Programs that manipulate strings or text often require the ability to iterate ov
236239

237240
To use the `char_iter`, put the following in your `Cargo.toml`
238241

239-
```
242+
```toml
240243
[dependencies]
241-
char-iter = "*"
244+
char-iter = "0.1"
242245
```
243246

244247
And then generate a character range with `char_iter::new()` method:
@@ -346,9 +349,9 @@ The [itertools crate](http://bluss.github.io/rust-itertools/doc/itertools/trait.
346349

347350
To use `itertools`, add the following to your `Cargo.toml`:
348351

349-
```
352+
```toml
350353
[dependencies]
351-
itertools = "*"
354+
itertools = "0.4"
352355
```
353356

354357
The `unique()` adaptor eliminates duplicates from an iterator. The duplicates do not need to be sequential.
@@ -365,7 +368,7 @@ for d in unique {
365368
}
366369

367370
//output: 1 4 3 2 5
368-
```
371+
```
369372

370373
The `join()` adaptor combines iterator elements into a single string with a separator in between the elements.
371374

@@ -378,7 +381,7 @@ let list = creatures.iter().join(", ");
378381
println!("In the enchanted forest, we found {}.", list);
379382

380383
// output: In the enchanted forest, we found banshee, basilisk, centaur.
381-
```
384+
```
382385

383386
The `sorted_by()` adaptor applies custom sorting order to iterator elements, returning a sorted vector. The following program will print out top 5 happiest countries, according to 2016 World Happiness Index.
384387

@@ -409,7 +412,6 @@ for (country, rating) in top_contries {
409412
// # 3: Iceland
410413
// # 4: Norway
411414
// # 5: Finland
412-
413415
```
414416

415417
## Creating Your Own Iterators

0 commit comments

Comments
 (0)