pub trait Subterms<PT: ProtocolTypes> {
// Required methods
fn find_subterm_same_shape(&self, term: &Term<PT>) -> Option<&Term<PT>>;
fn find_subterm<P: Fn(&&Term<PT>) -> bool + Copy>(
&self,
filter: P,
) -> Option<&Term<PT>>;
fn filter_grand_subterms<P: Fn(&Term<PT>, &Term<PT>) -> bool + Copy>(
&self,
predicate: P,
) -> Vec<((usize, &Term<PT>), &Term<PT>)>;
}
Required Methods§
fn find_subterm_same_shape(&self, term: &Term<PT>) -> Option<&Term<PT>>
fn find_subterm<P: Fn(&&Term<PT>) -> bool + Copy>( &self, filter: P, ) -> Option<&Term<PT>>
fn filter_grand_subterms<P: Fn(&Term<PT>, &Term<PT>) -> bool + Copy>( &self, predicate: P, ) -> Vec<((usize, &Term<PT>), &Term<PT>)>
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl<PT: ProtocolTypes> Subterms<PT> for Vec<Term<PT>>
impl<PT: ProtocolTypes> Subterms<PT> for Vec<Term<PT>>
source§fn find_subterm_same_shape(&self, term: &Term<PT>) -> Option<&Term<PT>>
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>>
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>)>
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
.