pub struct StructuralRecursion {
pub block: MutualBlock,
pub recursive_args: HashMap<Name, Vec<usize>>,
}Expand description
Encoder for structurally recursive definitions.
Transforms structurally recursive definitions into applications of the recursor (eliminator) for the decreasing argument’s type.
Fields§
§block: MutualBlockThe mutual block being processed
recursive_args: HashMap<Name, Vec<usize>>For each function, which argument indices are recursive
Implementations§
Source§impl StructuralRecursion
impl StructuralRecursion
Sourcepub fn new(block: MutualBlock) -> Self
pub fn new(block: MutualBlock) -> Self
Create a new structural recursion encoder.
Sourcepub fn detect_structural_recursion(&mut self) -> Result<(), MutualElabError>
pub fn detect_structural_recursion(&mut self) -> Result<(), MutualElabError>
Detect which arguments are structurally decreasing.
Sourcepub fn encode_as_recursor_application(
&self,
) -> Result<MutualBlock, MutualElabError>
pub fn encode_as_recursor_application( &self, ) -> Result<MutualBlock, MutualElabError>
Encode the structural recursion as recursor applications.
In a full implementation, this would replace each recursive function with an application of the appropriate recursor/eliminator.
Trait Implementations§
Source§impl Clone for StructuralRecursion
impl Clone for StructuralRecursion
Source§fn clone(&self) -> StructuralRecursion
fn clone(&self) -> StructuralRecursion
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StructuralRecursion
impl RefUnwindSafe for StructuralRecursion
impl Send for StructuralRecursion
impl Sync for StructuralRecursion
impl Unpin for StructuralRecursion
impl UnsafeUnpin for StructuralRecursion
impl UnwindSafe for StructuralRecursion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more