Skip to main content

Module helpers

Module helpers 

Source
Expand description

Various selector functions for different use cases.

A selector function accepts an iterator over (Rule, Update) pairs and returns the selected (Rule, Update), or None.

morph will call the given selector function when there is an ambiguity in which rule to apply. That is, when more than one rule from the same group returns [Some(...)] for a given sub-tree.

Functions§

select_first
Returns the first available (Rule, Update) if there is one, otherwise returns None.
select_panic
Panics when called by the engine, printing the original subtree and all applicable rules and their results.
select_random
Selects a random (Rule, Update) from the iterator.
select_smallest_subtree
Selects the (Rule, Update) which results in the smallest subtree.
select_user_input
Selects a (Rule, Update) based on user input through stdin.

Type Aliases§

SelectorFn
A uniform type for selector functions such as select_first.