Trait TreeAdapter

Source
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§

Source

fn root_id(&self) -> Key

Source

fn get_node(&self, node_id: &Key) -> Option<Node>

Get the Node size

Source

fn height(&self, node_id: &Key) -> Option<u16>

Get the height in the Tree of the given Node

Source

fn parent_of(&self, node_id: &Key) -> Option<Key>

Get the parent of a Node

Source

fn children_of(&mut self, node_id: &Key) -> Vec<Key>

Get the children of a Node

Provided Methods§

Source

fn closest_common_parent( &self, node_a: &Key, node_b: &Key, walker: impl FnMut(Key), ) -> Option<Key>

Get the closest common parent Node of two Nodes

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.

Implementors§