Struct lamcal::inspect::Limit[][src]

pub struct Limit { /* fields omitted */ }

Limits the number of steps a reduction or evaluation function performs until processing is stopped.

This inspection counts each call to the Inspect::inspect function. If the number of calls counted so far is less than the limit for which the Limit has been constructed it returns Stop::No to continue processing. If the limit has been reached it returns Stop::Yes to instruct the evaluation or reduction function to stop processing.

A limit of 0 means that not reduction will be performed at all.

Examples

let mut term = app(
    lam("a", app(var("a"), var("a"))),
    lam("a", app(var("a"), var("a"))),
);

term.reduce_inspected::<NormalOrder<Enumerate>, _>(&mut Limit::new(5));

Methods

impl Limit
[src]

Constructs a new Limit inspection with the given number of steps as the limit of reduction or evaluation steps.

The limit for the number steps.

The number of steps counted so far.

Trait Implementations

impl Debug for Limit
[src]

Formats the value using the given formatter. Read more

impl Clone for Limit
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Limit
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Default for Limit
[src]

Returns the "default value" for a type. Read more

impl Inspect for Limit
[src]

Inspects the term before the next step during processing and returns whether to continue processing or to stop it. Read more

Auto Trait Implementations

impl Send for Limit

impl Sync for Limit