Module wrapper

Module wrapper 

Source
Expand description

Inferer wrappers with state separated from the inferer.

This allows separation of stateful logic from the inner inferer, allowing the inner inferer to be swapped out while maintaining state in the wrappers.

This is an alternative to the old layered inferer setup, which tightly coupled the inner inferer with the wrapper state.

let inferer = ...;
// the root needs [`BaseCase`] passed as a base case.
let wrappers = RecurrentTrackerWrapper::new(BaseCase, inferer);
let wrapped = StatefulInferer::new(wrappers, infere);
// or
let wrapped = inferer.into_stateful(wrappers);
// or
let wrapped = wrappers.wrap(inferer);

Structs§

BaseWrapper
A no-op inferer wrapper that just calls the inner inferer directly. This is the base-case of wrapper stack.
StatefulInferer
An inferer that maintains state in wrappers around an inferer.

Traits§

InfererWrapper
A trait for wrapping an inferer with additional functionality.
InfererWrapperExt
Extension trait to allow easy wrapping of an inferer with a wrapper stack.
IntoStateful
Extension trait to allow easy wrapping of an inferer with a wrapper stack.