panes 0.19.0

Renderer-agnostic layout engine with declarative ergonomics
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use panes::{Constraints, LayoutTree, PanelId};

pub fn build_row_tree(count: usize, constraint: Constraints) -> (LayoutTree, Vec<PanelId>) {
    let mut tree = LayoutTree::new();
    let mut pids = Vec::new();
    let mut nids = Vec::new();
    for i in 0..count {
        let (pid, nid) = tree.add_panel(format!("p{i}"), constraint).unwrap();
        pids.push(pid);
        nids.push(nid);
    }
    let root = tree.add_row(0.0, nids).unwrap();
    tree.set_root(root);
    (tree, pids)
}