RulesSolver

Trait RulesSolver 

Source
pub trait RulesSolver {
    type Storage: Clone;
    type ChildInfo;

    // Required methods
    fn for_child<CR: FnOnce(AxisInfo) -> SizeRules>(
        &mut self,
        storage: &mut Self::Storage,
        child_info: Self::ChildInfo,
        child_rules: CR,
    );
    fn finish(self, storage: &mut Self::Storage) -> SizeRules;
}
Expand description

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.

Required Associated Types§

Source

type Storage: Clone

Type of storage

Source

type ChildInfo

Type required by RulesSolver::for_child (see implementation documentation)

Required Methods§

Source

fn for_child<CR: FnOnce(AxisInfo) -> SizeRules>( &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.

Source

fn finish(self, storage: &mut Self::Storage) -> SizeRules

Called at the end to output SizeRules.

Note that this does not include margins!

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.

Implementors§