Trait lay_rs::prelude::taffy::TraversePartialTree

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

This trait is 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§

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

Type representing an iterator of the children of a node

Required Methods§

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

Get the list of children IDs for the given node

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

Get the number of children for the given node

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

Object Safety§

This trait is not object safe.

Implementors§

§

impl<NodeContext> TraversePartialTree for TaffyTree<NodeContext>

§

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