Module lamcal::inspect [−][src]
The inspection mechanism for tracing and interrupting reduction and evaluation functions.
The inspection mechanism allows to trace the steps of reduction and evaluation functions and to stop reduction or evaluation depending on some condition.
The central piece of the inspection mechanism is the
Inspect
trait. The reduce_inspected
and
evaluate_inspected
functions take an implementation of the Inspect
trait
to extend the processing with some additional functionality. An
implementation of the Inspect
trait is called an inspection.
This module provides some implementation of the Inspect
trait:
- Limit : Limits the number of steps executed during evaluation or reduction.
- Trace : Allows to log or print the results of each step during evaluation or reduction.
- Collect : Collects clones of the term resulting from each single step during evaluation or reduction.
Inspections can be combined using the combinator inspections:
- And : Combines two inspections into one inspection that
stops processing if both inspections return
Stop::Yes
. - Or : Combines two inspections into one inspection that
stops processing if one of them returns
Stop::Yes
.
To construct the combinator inspections in a more concise syntax the
functions and
and or
are provided.
Structs
And |
AND combinator for two inspections that returns |
Collect |
Collects clones of the terms representing the results of each step during reduction or evaluation of a term. |
Limit |
Limits the number of steps a reduction or evaluation function performs until processing is stopped. |
NoOp |
No operation inspection. |
Or |
OR combinator for two inspections that returns |
Trace |
Trace turns a closure into an implementation of the |
Enums
Stop |
Indicator whether to stop or continue some processing. |
Traits
Inspect |
The inspect trait allows to inspect the current term before each step during processing of a term and conditionally stop further processing. |
Functions
and |
Combines two given inspections into an |
or |
Combines the two given inspections into an |