Announcing `dendron`, a crate for generic tree structure

I released dendron v0.1.1 today.
This is a crate to create and manipulate generic tree data.
(docs, comparisons)

What you get

  • A strong / weak reference to a node or a tree
    • Until you discard the last reference to a tree or a node, the entire tree is preserved.
  • Ability to lock tree hierarchy
    • You can temporarily forbid tree hierarchy modification, or forbid
      "forbidding tree hierarchy modification".
  • True tree structure
    • Every tree has just one root node.
    • Root node does not have siblings.
  • Sending subtrees between threads
    • The crate provides (de)serialization from/into series of "event"s, and events can be sent between threads.
  • Iterators
    • Ancestors, descendants (depth-first and breadth-first), children, and preceding/following siblings.

You would be free from...

  • Mutability management
    • No arena, so no &mut arena.
    • You can mutate multiple nodes at a time (in single thread).
  • Bringing the "tree" everywhere
    • You only have a reference to the leaf node? Enough!
      Entire tree (i.e. the root node and its descendants) are still alive!
  • Pairing of tree/arena and node/id
    • No mismatch of tree and node can happen.
  • Multiple-tree / multiple-arena management
    • Cutting a subtree and joining to another tree? Just do it!
    • Node references know what tree it belongs to, even if they are detached and moved to another tree.

Why yet another tree structure?

My original motivation is to write a document processor and document format convertor.
However, tree structure crates I know (specifically indextree and rctree) is not what I wanted (though I'm hugely inspired them), so I need to write a new one...

The main point is, I wrote this crate to manage "DOM"-like structure.
I wanted to manage "true tree"s, and wanted to move nodes seamlessly without being conscious of "arena" or "root node" to make the tree alive.
You may be surprised, but you cannot do this without pitfall, using indextree and rctree...

What do you want?

Have you ever wanted generic tree types?
If so, did you find satisfying or favorite crates?
Tell me your thoughts about current situation of tree structure in Rust!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.