split

Function split 

Source
pub fn split(rect: &Rect, amount: usize, axis: Option<Split>) -> Vec<Rect>
Expand description

Splits the provided Rect into smaller rectangles according to the provided Split.

ยงRemainders

If a rectangle can not be split into even sizes that fill the whole original Rect, some of the resulting rectangles might be slightly bigger than others to account for the remaining space.

ie. When horizontally splitting a rectangle of 100px height into 3 pieces, the resulting rectangles will be of the heights: 34px, 33px, and 33px. The first rectangle being slightly taller to account for the remaining space that must be filled out.

The rectangles will differ by 1px at maximum. The remaining space of the division is distributed evenly and by order accross the resulting rectangles, until no remaining space is left.