Subterms

Trait 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)>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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§