NodeTree
NodeTree is a framework to create large scalable programs and games through a tree of processes. Each process is fully autonomous and is capable of storing its own state or data, and communicating with other processes. These processes are known as Nodes.
β οΈWARNINGβ οΈ This crate is in early development. Beware of possible bugs or safety violations.
Getting Started!
Simply either run cargo add node_tree at the terminal directed towards the directory of your project, or add node_tree = X.X to your cargo.toml file.
To begin creating a program in Rust that utilizes a NodeTree, we must first create a root Node. In order to reduce boilerplate, we will use the included class! macro to implement the required Dynamic, NodeAbstract, and Node traits.
use *;
class!
Finally, in order to activate our NodeTree, we must instance the root Node and feed it into the NodeTree constructor.
// ...previous implementations
use TreeSimple;
Node Scenes
You may also input a NodeScene when initializing a NodeTree or adding a child via add_child:
use *;
let scene: NodeScene = scene! ;
// Scenes can also be cloned, stored, and reused.
let _ = scene.clone;
Logging
Logging is also supported. Here is an example setup with an output of a warning and a crash. Note that the crash header/footer are customizable, and that the output is actually colored in a real terminal.
use *;
use TreeSimple;
class!

Signals
Signals are introduced in order to allow for easy communication between various nodes. An example is shown below:
use *;
use TreeSimple;
class!
class!
About Cloning
All nodes are expected to implement the Clone trait since there are a few implementations that depend on it, such as NodeScene. However, it is possible to mark a field of a node so that it either has a special clone attribute or is uncloneable via provided types by this crate:
use ; // All of these types implement Deref & DerefMut!
Features
- ποΈ An easy abstraction framework for different processes to communicate and interact with each other in a scalable manner. Inspired by Godot!
- β―οΈ The ability to
pause()andunpause()theNodeTree, and fine tune individualNodebehaviours for when a tree is paused/unpaused. - π‘ Various methods to communicate with other nodes, such as
owner(),parent(),get_child(),children(), andget_node(), as well as methods to automate the process such as signals. - π An abstracted smart pointer known as
Tp<T>andTpDynwhich clones implicitly to reduce syntax noise and allows for low boilerplate. - π A caching system hosted on the
NodeTreeto act as a safe interface to ensureTp<T>/TpDynsoundness, and increase performance! - πͺ The ability to manage nodes with
add_child()andremove_child(). - π Includes a dynamic logging and error handling system that is deeply integrated with the node framework.
- π² Allows for the direct referencing of the
NodeTreethrough a node'sroot()function. - π Includes a method to save (TODO) and handle individual node scenes, such as the handy visual macro
scene!.