[−][src]Trait kas::layout::RulesSolver
A SizeRules
solver for layouts
Typically, a solver is invoked twice, once for each axis, before the
corresponding RulesSetter
is invoked. This is managed by SolveCache
.
Implementations require access to storage able to persist between multiple
solver runs and a subsequent setter run. This storage is of type
RulesSolver::Storage
and is passed via reference to the constructor.
Associated Types
type Storage: Clone
Type of storage
type ChildInfo
Type required by RulesSolver::for_child
(see implementation documentation)
Required methods
fn for_child<CR: FnOnce(AxisInfo) -> SizeRules>(
&mut self,
storage: &mut Self::Storage,
child_info: Self::ChildInfo,
child_rules: CR
)
&mut self,
storage: &mut Self::Storage,
child_info: Self::ChildInfo,
child_rules: CR
)
Called once for each child. For most layouts the order is important.
fn finish(self, storage: &mut Self::Storage) -> SizeRules
Called at the end to output SizeRules
.
Note that this does not include margins!
Implementors
impl RulesSolver for SingleSolver
[src]
type Storage = ()
type ChildInfo = ()
fn for_child<CR: FnOnce(AxisInfo) -> SizeRules>(
&mut self,
_storage: &mut Self::Storage,
_child_info: Self::ChildInfo,
child_rules: CR
)
[src]
&mut self,
_storage: &mut Self::Storage,
_child_info: Self::ChildInfo,
child_rules: CR
)
fn finish(self, _storage: &mut Self::Storage) -> SizeRules
[src]
impl<CSR, RSR, S: GridStorage> RulesSolver for GridSolver<CSR, RSR, S> where
CSR: AsRef<[(SizeRules, u32, u32)]> + AsMut<[(SizeRules, u32, u32)]>,
RSR: AsRef<[(SizeRules, u32, u32)]> + AsMut<[(SizeRules, u32, u32)]>,
[src]
CSR: AsRef<[(SizeRules, u32, u32)]> + AsMut<[(SizeRules, u32, u32)]>,
RSR: AsRef<[(SizeRules, u32, u32)]> + AsMut<[(SizeRules, u32, u32)]>,
type Storage = S
type ChildInfo = GridChildInfo
fn for_child<CR: FnOnce(AxisInfo) -> SizeRules>(
&mut self,
storage: &mut Self::Storage,
child_info: Self::ChildInfo,
child_rules: CR
)
[src]
&mut self,
storage: &mut Self::Storage,
child_info: Self::ChildInfo,
child_rules: CR
)