From 097dd34b392248bba1f50865c470ca9324255199 Mon Sep 17 00:00:00 2001 From: Riccardo Mazzarini Date: Sat, 2 Dec 2023 16:30:37 +0100 Subject: [PATCH] tweak `cities` example --- Cargo.toml | 4 ++++ README.md | 4 +++- examples/cities.rs | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5dbd9b7..c379b84 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,3 +41,7 @@ required-features = ["bench"] name = "fzf_v2" harness = false required-features = ["bench"] + +[[example]] +name = "cities" +required-features = ["fzf-v2"] diff --git a/README.md b/README.md index 5740ee3..6a6afe1 100644 --- a/README.md +++ b/README.md @@ -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; @@ -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> = Vec::new(); let _ = fzf.distance_and_ranges(query, results[0].0, &mut ranges); assert_eq!(ranges.len(), 2); diff --git a/examples/cities.rs b/examples/cities.rs index 0df4442..fa3cdd0 100644 --- a/examples/cities.rs +++ b/examples/cities.rs @@ -1,3 +1,5 @@ +use std::ops::Range; + use norm::fzf::{FzfParser, FzfV2}; use norm::Metric; @@ -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> = Vec::new(); let _ = fzf.distance_and_ranges(query, results[0].0, &mut ranges); assert_eq!(ranges.len(), 2);