Skip to content

Commit

Permalink
tweak cities example
Browse files Browse the repository at this point in the history
  • Loading branch information
noib3 committed Dec 2, 2023
1 parent 366c254 commit 097dd34
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ required-features = ["bench"]
name = "fzf_v2"
harness = false
required-features = ["bench"]

[[example]]
name = "cities"
required-features = ["fzf-v2"]
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ each other, as well as to other popular libraries.
## Example usage

```rust
use std::ops::Range;

use norm::fzf::{FzfParser, FzfV2};
use norm::Metric;

Expand Down Expand Up @@ -55,7 +57,7 @@ assert_eq!(results[1].0, "Ulaanbaatar");

// We can also find out which sub-strings of each candidate matched the query.

let mut ranges = Vec::new();
let mut ranges: Vec<Range<usize>> = Vec::new();

let _ = fzf.distance_and_ranges(query, results[0].0, &mut ranges);
assert_eq!(ranges.len(), 2);
Expand Down
4 changes: 3 additions & 1 deletion examples/cities.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::ops::Range;

use norm::fzf::{FzfParser, FzfV2};
use norm::Metric;

Expand All @@ -22,7 +24,7 @@ fn main() {
assert_eq!(results[0].0, "Adelaide");
assert_eq!(results[1].0, "Ulaanbaatar");

let mut ranges = Vec::new();
let mut ranges: Vec<Range<usize>> = Vec::new();

let _ = fzf.distance_and_ranges(query, results[0].0, &mut ranges);
assert_eq!(ranges.len(), 2);
Expand Down

0 comments on commit 097dd34

Please sign in to comment.