Skip to main content

TreeNode

Trait TreeNode 

Source
pub trait TreeNode {
    // Required methods
    fn label(&self) -> String;
    fn children(&self) -> Vec<&dyn TreeNode>;

    // Provided methods
    fn status(&self) -> Option<NodeStatus> { ... }
    fn metadata(&self) -> Vec<(String, String)> { ... }
}
Expand description

A node in a tree. Implementors provide a label, optional status, optional metadata key/value pairs (rendered as a sub-line under the node label), and a list of children.

Required Methods§

Source

fn label(&self) -> String

Source

fn children(&self) -> Vec<&dyn TreeNode>

Provided Methods§

Source

fn status(&self) -> Option<NodeStatus>

Source

fn metadata(&self) -> Vec<(String, String)>

Extra (key, value) pairs rendered inline after the label (e.g. "r0", "12ms" → [r0=12ms]). Useful for round IDs, durations, sizes — anything that helps reading the tree.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§