Struct cassowary::Solver [] [src]

pub struct Solver { /* fields omitted */ }

A constraint solver using the Cassowary algorithm. For proper usage please see the top level crate documentation.

Methods

impl Solver
[src]

Construct a new solver.

Add a constraint to the solver.

Remove a constraint from the solver.

Test whether a constraint has been added to the solver.

Add an edit variable to the solver.

This method should be called before the suggest_value method is used to supply a suggested value for the given edit variable.

Remove an edit variable from the solver.

Test whether an edit variable has been added to the solver.

Suggest a value for the given edit variable.

This method should be used after an edit variable has been added to the solver in order to suggest the value for that variable.

Fetches all changes to the values of variables since the last call to this function.

The list of changes returned is not in a specific order. Each change comprises the variable changed and the new value of that variable.

Note that variables start with an implicit value of zero. If a variable never changes from zero a change may not be returned from this function for it.

Reset the solver to the empty starting condition.

This method resets the internal solver state to the empty starting condition, as if no constraints or edit variables have been added. This can be faster than deleting the solver and creating a new one when the entire system must change, since it can avoid unnecessary heap (de)allocations.