Yada is a yet another double-array trie library aiming for fast search and compact data representation.
Iterator
that is an effective way to find multiple
values without heap allocation.Option
.See also example code for more details.
```rust use yada::builder::DoubleArrayBuilder;
// make a keyset which have key-value pairs let keyset = &[ ("a".asbytes(), 0), ("ab".asbytes(), 1), ("abc".asbytes(), 2), ("b".asbytes(), 3), ("bc".asbytes(), 4), ("c".asbytes(), 5), ];
// build a double-array trie binary
let da_bytes: Option
```rust use yada::DoubleArray;
// create a double-array trie instance let da = DoubleArray::new(da_bytes.unwrap());
// exact match search for (key, value) in keyset { asserteq!(da.exactmatchsearch(key), Some(*value as u32)); } asserteq!(da.exactmatchsearch("abc".asbytes()), Some(2)); asserteq!(da.exactmatchsearch("abcd".as_bytes()), None);
// common prefix search
asserteq!(
da.commonprefixsearch("abcd".asbytes())
.collect::
u32
.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.