11 releases

Uses old Rust 2015

0.5.0 Mar 17, 2023
0.4.0 May 28, 2021
0.3.0 Jan 11, 2018
0.2.0 Jan 31, 2017
0.1.4 Feb 20, 2016

#859 in Text processing

Download history 1046/week @ 2024-07-04 1071/week @ 2024-07-11 804/week @ 2024-07-18 901/week @ 2024-07-25 763/week @ 2024-08-01 941/week @ 2024-08-08 1051/week @ 2024-08-15 949/week @ 2024-08-22 932/week @ 2024-08-29 778/week @ 2024-09-05 1069/week @ 2024-09-12 1361/week @ 2024-09-19 1940/week @ 2024-09-26 1923/week @ 2024-10-03 2342/week @ 2024-10-10 1478/week @ 2024-10-17

8,102 downloads per month
Used in 6 crates (2 directly)

MIT license

22KB
351 lines

rust-bk-tree

A BK-tree implementation in Rust.

Build Status Crates.io Clippy Linting Result

Documentation

Examples

Here's some example usages:

use bk_tree::{BKTree, metrics};

// A BK-tree using the Levenshtein distance metric.
let mut tree: BKTree<&str> = BKTree::new(metrics::levenshtein);

tree.add("foo");
tree.add("bar");
tree.add("baz");
tree.add("bup");

tree.find("bar", 0); // returns vec!["bar"]
tree.find("bar", 1); // returns vec!["bar", "baz"]
tree.find("bup", 2); // returns vec!["bar", "baz", "bup"]

Benchmarks

To run benchmarks, you need to have the nightly version of Rust installed. If you do (and use multirust, for example), then you can run

rustup run nightly cargo bench

to run benchmarks.

Dependencies

~225–390KB