A lightweight and fast router with no_std support. The main library comes in at 182 lines only.
use keetree::Node;
fn main() {
let router = Node::default();
node.insert("a/b/c".split('/'), 1)
assert_eq!(node.match("a/b/c".split('/')).unwrap(), 1)
}
Inserts on the same route with different values will update it.
Only twice as slow as matchit
which is the fastest rust router (that I know of). Not bad for something that's completely unoptimized. You can find matchit
's benchmarks here.
Library | Match |
---|---|
matchit | 190.58 ns |
keetree | 490.32 ns |