pub struct Solver<T> where
    T: Debug + Clone + Eq + Hash
{ /* private fields */ }
Expand description

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

Implementations

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.

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.

Get the stored value for a variable.

Normally values should be retrieved and updated using fetch_changes, but this method can be used for debugging or testing.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.