Function tui::layout::split [] [src]

pub fn split(
    area: &Rect,
    dir: &Direction,
    margin: u16,
    sizes: &[Size]
) -> Vec<Rect>

Wrapper function around the cassowary-rs solver to be able to split a given area into smaller ones based on the preferred widths or heights and the direction.

Examples


    let chunks = split(&Rect{x: 2, y: 2, width: 10, height: 10},
                       &Direction::Vertical,
                       0,
                       &[Size::Fixed(5), Size::Min(0)]);
    assert_eq!(chunks, vec![Rect{x:2, y: 2, width: 10, height: 5},
                            Rect{x: 2, y: 7, width: 10, height: 5}])