Git Product home page Git Product logo

rusty_trees's Introduction

Rusty Trees

A place to put various tree data structures written in Rust. Rustdocs here.

(also known as a compressed trie or compact prefix trie)

A radix trie, RadixTrie<K, V> where K: Key, is generic over its key (see trait Key) and value types. There is no restriction on the value type.

An implementation of Key for String is provided.

Methods

Methods behave identically to those of HashMap. See the documentation for more info.

  • insert - insert a value, returning the old value (if any)
  • remove - remove a value, returning the old value (if any)
  • get - get the value (if present)
  • iter - iterate over (&Key, &Value) pairs within the trie
  • iter_mut - mutable iterator over (&Key, &mut Value) pairs

Tests

Run with cargo test

Fuzzing

RadixTrie has a fuzzing harness built with cargo fuzz. See fuzz/fuzz_targets/radix_trie.rs for the implementation.

Run the fuzzer with the following wrapper script, or directly with cargo fuzz if building with nightly:

$> # if not already installed
$> cargo install cargo-fuzz
$>
$> ./fuzz/fuzz run radix_trie
$> ./fuzz/fuzz run -j8 radix_trie # run multiple fuzzer workers

(Note that cargo-fuzz requires a nightly toolchain, and the ./fuzz/fuzz wrapper script invokes this automatically).


Convert the fuzzer corpus into tests to run with cargo test, and enable building fuzzer generated tests with the run_fuzzer_tests feature:

$> ./fuzz/corpus_to_generated_tests
$> cargo test --feature=run_fuzzer_tests

To remove the fuzzer generated tests, run truncate -s0 src/radix_trie/fuzzer_tests.rs.


With the fuzzer corpus included as unit tests, one can use cargo-llvm-cov to generate coverage information:

$> cargo llvm-cov --verbose --html
$> open target/llvm-cov/html/index.html

rusty_trees's People

Contributors

dymk avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.