pub trait GridStorage:
Sealed
+ Clone
+ Debug {
// Required methods
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]);
// Provided methods
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§
Sourcefn widths_and_rules(&mut self) -> (&mut [i32], &mut [SizeRules])
fn widths_and_rules(&mut self) -> (&mut [i32], &mut [SizeRules])
Access column widths and rules simultaneously
Sourcefn heights_and_rules(&mut self) -> (&mut [i32], &mut [SizeRules])
fn heights_and_rules(&mut self) -> (&mut [i32], &mut [SizeRules])
Access row heights and rules simultaneously
Provided Methods§
Sourcefn width_rules(&mut self) -> &mut [SizeRules]
fn width_rules(&mut self) -> &mut [SizeRules]
Access SizeRules
for each column
Sourcefn height_rules(&mut self) -> &mut [SizeRules]
fn height_rules(&mut self) -> &mut [SizeRules]
Access SizeRules
for each row
Sourcefn widths(&mut self) -> &mut [i32]
fn widths(&mut self) -> &mut [i32]
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
).
Sourcefn heights(&mut self) -> &mut [i32]
fn heights(&mut self) -> &mut [i32]
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
).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.