All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Now deriving the following traits, for many data structures:
- Added "rayon" crate feature, an optional feature in its dependencies.
- Switched from Travis continuous integration to GitHub Actions.
- Updated Rust version requirement from 1.33.0 to 1.75.0 for all features and 1.67.0 for no features.
- Add methods to
IncSearch:prefix(),prefix_len(),- and
goto_longest_prefix().
- Add
iter()method toTrieandmap::Trie.
-
Use iterators for search results.
Benefits being that they're lazy, short-circuitable, and require less memory.
let a: Vec<Vec<u8>> = trie.predictive_search("ech").take(10).collect();
-
Allow
Labelcollection type to be specified.This includes machinery in
crate::try_collectto allow us to collect intoStringdirectly.
let a: Vec<Vec<u8>> = trie.predictive_search("ech").collect();
let b: Vec<String> = trie.predictive_search("ech").collect();
-
Add incremental search.
Lets the user build their query one label at a time.
let mut builder = TrieBuilder::new();
builder.push("a", 0);
builder.push("app", 1);
builder.push("apple", 2);
let trie = builder.build();
let mut search = trie.inc_search();
assert_eq!(None, search.query(&b'z'));
assert_eq!(Answer::PrefixAndMatch, search.query(&b'a').unwrap());
assert_eq!(Answer::Prefix, search.query(&b'p').unwrap());
assert_eq!(Answer::PrefixAndMatch, search.query(&b'p').unwrap());
assert_eq!(Answer::Prefix, search.query(&b'l').unwrap());
assert_eq!(Answer::Match, search.query(&b'e').unwrap());
If your search can be O(log n) instead of O(m log n), do that.
-
Add
Trie::postfix_search(). -
Add
map::Trie::exact_match_mut()to mutateValues. -
Add
Trie::longest_prefix().Find the longest prefix. This is the kind of behavior one would want to implement tab completion for instance.
-
No longer panics on zero-length string queries.
Previously a zero-length query would instantiate the entirety of the trie essentially uncompressed. Now, however, an iterator only allocates one word at a time, and one can limit their search results to avoid whole trie collection.
let b: Vec<String> = trie.predictive_search("").take(100).collect();
- Make Trie cloneable.
- Add
trie_rs::map::{Trie, TrieBuilder}(#20) - Add
is_prefix().
Only internal data type change.
Initial release.