pub trait TreeAdapter<Key: NodeKey> {
// Required methods
fn root_id(&self) -> Key;
fn get_node(&self, node_id: &Key) -> Option<Node>;
fn height(&self, node_id: &Key) -> Option<u16>;
fn parent_of(&self, node_id: &Key) -> Option<Key>;
fn children_of(&mut self, node_id: &Key) -> Vec<Key>;
// Provided method
fn closest_common_parent(
&self,
node_a: &Key,
node_b: &Key,
walker: impl FnMut(Key),
) -> Option<Key> { ... }
}Required Methods§
fn root_id(&self) -> Key
Sourcefn children_of(&mut self, node_id: &Key) -> Vec<Key>
fn children_of(&mut self, node_id: &Key) -> Vec<Key>
Get the children of a Node
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.