Trait tree_layout::NodeInfo
source · pub trait NodeInfo<N>where
Self::Key: Eq + Hash,
N: Clone,{
type Key;
// Required methods
fn key(&self, node: N) -> Self::Key;
fn children(&self, node: N) -> impl Iterator<Item = N>;
// Provided methods
fn dimensions(&self, node: N) -> TreeBox { ... }
fn border(&self, node: N) -> TreeBox { ... }
}
Required Associated Types§
Required Methods§
Provided Methods§
sourcefn dimensions(&self, node: N) -> TreeBox
fn dimensions(&self, node: N) -> TreeBox
Returns the dimensions of a given node.
This is the padding that you want around the centre point of the node so that you can line things up as you want to (e.g. nodes aligned by their top border vs being aligned by their centres).
This value is generic over units (but all nodes must use the same unit) and the layout that this crate calculates will be given in terms of this unit. For example if you give this value in pixels then the layout will be given in terms of number of pixels from the left of the tree. Alternatively you might want to give this value in terms of the proportion of the width of your window (though note that this does not guarantee that the tree will fit in your window).
Default
By default the algorithm assumes that each node is point-like (i.e. has no width or height).