File: README.md

package info (click to toggle)
rust-bk-tree 0.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 204 kB
  • sloc: makefile: 2
file content (36 lines) | stat: -rw-r--r-- 1,151 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# rust-bk-tree
A BK-tree implementation in Rust.

[![Build Status](https://travis-ci.org/eugene-bulkin/rust-bk-tree.svg?branch=master)](https://travis-ci.org/eugene-bulkin/rust-bk-tree) [![Crates.io](https://img.shields.io/crates/v/bk-tree.svg)](https://crates.io/crates/bk-tree) [![Clippy Linting Result](http://clippy.bashy.io/github/eugene-bulkin/rust-bk-tree/master/badge.svg)](http://clippy.bashy.io/github/eugene-bulkin/rust-bk-tree/master/log)

[Documentation](https://docs.rs/bk-tree/)

# Examples

Here's some example usages:

```rust
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](/brson/multirust), for example), then you can run

```
rustup run nightly cargo bench
```

to run benchmarks.