Trait puffin::algebra::term::Subterms

source ·
pub trait Subterms<PT: ProtocolTypes, T>
where T: TermType<PT>,
{ // Required methods fn find_subterm_same_shape(&self, term: &T) -> Option<&T>; fn find_subterm<P: Fn(&&T) -> bool + Copy>(&self, filter: P) -> Option<&T>; fn filter_grand_subterms<P: Fn(&T, &T) -> bool + Copy>( &self, predicate: P, ) -> Vec<((usize, &T), &T)>; }

Required Methods§

source

fn find_subterm_same_shape(&self, term: &T) -> Option<&T>

source

fn find_subterm<P: Fn(&&T) -> bool + Copy>(&self, filter: P) -> Option<&T>

source

fn filter_grand_subterms<P: Fn(&T, &T) -> bool + Copy>( &self, predicate: P, ) -> Vec<((usize, &T), &T)>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<PT: ProtocolTypes> Subterms<PT, Term<PT>> for Vec<Term<PT>>

source§

fn find_subterm_same_shape(&self, term: &Term<PT>) -> Option<&Term<PT>>

Finds a subterm with the same type as term

source§

fn find_subterm<P: Fn(&&Term<PT>) -> bool + Copy>( &self, predicate: P, ) -> Option<&Term<PT>>

Finds a subterm in this vector

source§

fn filter_grand_subterms<P: Fn(&Term<PT>, &Term<PT>) -> bool + Copy>( &self, predicate: P, ) -> Vec<((usize, &Term<PT>), &Term<PT>)>

Finds all grand children/subterms which match the predicate.

A grand subterm is defined as a subterm of a term in self.

Each grand subterm is returned together with its parent and the index of the parent in self.

Implementors§