Enum puffin::algebra::term::Term

source ·
pub enum Term<PT: ProtocolTypes> {
    Variable(Variable<PT>),
    Application(Function<PT>, Vec<Term<PT>>),
}
Expand description

A first-order term: either a Variable or an application of an Function.

Variants§

§

Variable(Variable<PT>)

A concrete but unspecified Term (e.g. x, y). See Variable for more information.

§

Application(Function<PT>, Vec<Term<PT>>)

An Function applied to zero or more Terms (e.g. (f(x, y), g()).

A Term that is an application of an Function with arity 0 applied to 0 Terms can be considered a constant.

Implementations§

source§

impl<PT: ProtocolTypes> Term<PT>

source

pub fn resistant_id(&self) -> u32

source

pub fn size(&self) -> usize

source

pub fn is_leaf(&self) -> bool

source

pub fn get_type_shape(&self) -> &TypeShape<PT>

source

pub fn name(&self) -> &str

source

pub fn mutate(&mut self, other: Term<PT>)

source

fn display_at_depth(&self, depth: usize) -> String

source

pub fn evaluate<PB>( &self, context: &TraceContext<PB>, ) -> Result<Box<dyn EvaluatedTerm<PT>>, Error>
where PB: ProtocolBehavior<ProtocolTypes = PT>,

source§

impl<PT: ProtocolTypes> Term<PT>

source

fn unique_id(&self, tree_mode: bool, cluster_id: usize) -> String

source

fn node_attributes( displayable: impl Display, color: &str, shape: &str, ) -> String

source

fn collect_statements( term: &Term<PT>, tree_mode: bool, cluster_id: usize, statements: &mut Vec<String>, )

source

pub fn dot_subgraph( &self, tree_mode: bool, cluster_id: usize, label: &str, ) -> String

If tree_mode is true then each subgraph is self-contained and does not reference other clusters or nodes outside of this subgraph. Therefore, only trees are generated. If it is false, then graphs are rendered.

source§

impl<PT: ProtocolTypes> Term<PT>

source

pub fn count_functions_by_name(&self, find_name: &'static str) -> usize

Trait Implementations§

source§

impl<PT: Clone + ProtocolTypes> Clone for Term<PT>

source§

fn clone(&self) -> Term<PT>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<PT: Debug + ProtocolTypes> Debug for Term<PT>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, PT> Deserialize<'de> for Term<PT>
where PT: ProtocolTypes,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<PT: ProtocolTypes> Display for Term<PT>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<PT: Hash + ProtocolTypes> Hash for Term<PT>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a, PT: ProtocolTypes> IntoIterator for &'a Term<PT>

source§

type IntoIter = IntoIter<&'a Term<PT>>

Which kind of iterator are we turning this into?
source§

type Item = &'a Term<PT>

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<PT: PartialEq + ProtocolTypes> PartialEq for Term<PT>

source§

fn eq(&self, other: &Term<PT>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<PT> Serialize for Term<PT>
where PT: ProtocolTypes,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<PT: Eq + ProtocolTypes> Eq for Term<PT>

source§

impl<PT: ProtocolTypes> StructuralPartialEq for Term<PT>

Auto Trait Implementations§

§

impl<PT> Freeze for Term<PT>
where <PT as ProtocolTypes>::Matcher: Freeze,

§

impl<PT> !RefUnwindSafe for Term<PT>

§

impl<PT> Send for Term<PT>
where PT: Send, <PT as ProtocolTypes>::Matcher: Send,

§

impl<PT> Sync for Term<PT>
where PT: Sync, <PT as ProtocolTypes>::Matcher: Sync,

§

impl<PT> Unpin for Term<PT>
where PT: Unpin, <PT as ProtocolTypes>::Matcher: Unpin,

§

impl<PT> !UnwindSafe for Term<PT>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsAny for T
where T: 'static,

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneAny for T
where T: Any + Clone + Send + Sync,

§

fn clone_any(&self) -> Box<dyn CloneAny>

§

fn clone_any_send(&self) -> Box<dyn CloneAny + Send>

§

fn clone_any_sync(&self) -> Box<dyn CloneAny + Sync>

§

fn clone_any_send_sync(&self) -> Box<dyn CloneAny + Sync + Send>

source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<Tail, T> Prepend<T> for Tail

§

type PreprendResult = Tail

The Resulting [TupleList], of an [Prepend::prepend()] call, including the prepended entry.
§

fn prepend(self, value: T) -> (T, <Tail as Prepend<T>>::PreprendResult)

Prepend a value to this tuple, returning a new tuple with prepended value.
source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> DebugAny for T
where T: Any + Debug,

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> MaybeHasScalabilityMonitor for T

§

impl<T> UnsafeAny for T
where T: Any,