pub trait GridStorage: Sealed + Clone + Debug {
    fn set_dims(&mut self, cols: usize, rows: usize);
    fn widths_and_rules(&mut self) -> (&mut [i32], &mut [SizeRules]);
    fn heights_and_rules(&mut self) -> (&mut [i32], &mut [SizeRules]);

    fn width_rules(&mut self) -> &mut [SizeRules] { ... }
    fn height_rules(&mut self) -> &mut [SizeRules] { ... }
    fn widths(&mut self) -> &mut [i32] { ... }
    fn heights(&mut self) -> &mut [i32] { ... }
}
Expand description

Requirements of grid solver storage type

Usually this is set by a crate::layout::GridSolver from crate::Layout::size_rules, then used by crate::Layout::set_rect to divide the assigned rect between children.

It may be useful to access this directly if not solving size rules normally; specifically this allows a different size solver to replace size_rules and influence set_rect.

Note: some implementations allocate when Self::set_dims is first called. It is expected that this method is called before other methods.

Required Methods

Set dimension: number of columns and rows

Access column widths and rules simultaneously

Access row heights and rules simultaneously

Provided Methods

Access SizeRules for each column

Access SizeRules for each row

Access widths for each column

Widths are calculated from rules when set_rect is called. Assigning to widths before set_rect is called only has any effect when the available size exceeds the minimum required (see SizeRules::solve_seq).

Access heights for each row

Heights are calculated from rules when set_rect is called. Assigning to heights before set_rect is called only has any effect when the available size exceeds the minimum required (see SizeRules::solve_seq).

Implementors