add simsearch
This commit is contained in:
23
simsearch/Cargo.lock
generated
Normal file
23
simsearch/Cargo.lock
generated
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
[[package]]
|
||||||
|
name = "simsearch"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"simsearch 0.2.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "simsearch"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d481708c05c4ba0cb8d13db888d2c4e13cc935143bc7c907ed5bec7c61be218a"
|
||||||
|
dependencies = [
|
||||||
|
"strsim",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strsim"
|
||||||
|
version = "0.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||||
11
simsearch/Cargo.toml
Normal file
11
simsearch/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[package]
|
||||||
|
name = "simsearch"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
simsearch = "0.2"
|
||||||
|
|
||||||
14
simsearch/src/main.rs
Normal file
14
simsearch/src/main.rs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
use simsearch::SimSearch;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut engine: SimSearch<u32> = SimSearch::new();
|
||||||
|
|
||||||
|
engine.insert(1, "Things Fall Apart");
|
||||||
|
engine.insert(2, "The Old Man and the Sea");
|
||||||
|
engine.insert(3, "James Joyce");
|
||||||
|
|
||||||
|
let results: Vec<u32> = engine.search("thngs");
|
||||||
|
for r in results {
|
||||||
|
println!("{:?}", r);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user