Skip to main content

TraversePartialTree

Trait TraversePartialTree 

Source
pub trait TraversePartialTree {
    type ChildIter<'a>: Iterator<Item = NodeId>
       where Self: 'a;

    // Required methods
    fn child_ids(&self, parent_node_id: NodeId) -> Self::ChildIter<'_>;
    fn child_count(&self, parent_node_id: NodeId) -> usize;
    fn get_child_id(&self, parent_node_id: NodeId, child_index: usize) -> NodeId;
}
Expand description

Taffy’s abstraction for downward tree traversal.

However, this trait does not require access to any node’s other than a single container node’s immediate children unless you also intend to implement TraverseTree.

Required Associated Types§

Source

type ChildIter<'a>: Iterator<Item = NodeId> where Self: 'a

Type representing an iterator of the children of a node

Required Methods§

Source

fn child_ids(&self, parent_node_id: NodeId) -> Self::ChildIter<'_>

Get the list of children IDs for the given node

Source

fn child_count(&self, parent_node_id: NodeId) -> usize

Get the number of children for the given node

Source

fn get_child_id(&self, parent_node_id: NodeId, child_index: usize) -> NodeId

Get a specific child of a node, where the index represents the nth child

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<NodeContext> TraversePartialTree for TaffyTree<NodeContext>

Source§

type ChildIter<'a> = TaffyTreeChildIter<'a> where TaffyTree<NodeContext>: 'a