Struct cop::App

source ·
pub struct App<H, A>(/* private fields */);
Expand description

Application of argument(s) to a head.

Implementations§

source§

impl<H, A> App<H, A>

source

pub fn new(head: H, args: A) -> Self

Create a new application of arguments to a head symbol.

source

pub fn head(&self) -> &H

Get the head symbol.

source

pub fn args(&self) -> &A

Get the arguments.

source

pub fn map_head<I>(self, f: impl FnOnce(H) -> I) -> App<I, A>

Apply a function to the head.

source

pub fn map_args<B>(self, f: impl FnOnce(A) -> B) -> App<H, B>

Apply a function to the arguments.

source§

impl<V> App<Signed<String>, Args<Term<String, V>>>

source

pub fn symbolise<'a>( self, set: &mut HashSet<&'a str>, arena: &'a Arena<String> ) -> Lit<Signed<Symbol<'a>>, Symbol<'a>, V>

Map strings in a literal to symbols.

This serves to make the equality check between symbols a constant-time operation.

source§

impl<P, C, V> App<P, Args<Term<C, V>>>

source

pub fn is_ground(&self) -> bool

Returns true iff no variable occurs in the literal.

source

pub fn vars(&self) -> impl Iterator<Item = &V>

The variables occurring in the literal.

source

pub fn map_vars<W>(self, f: &mut impl FnMut(V) -> Term<C, W>) -> Lit<P, C, W>

Apply a function to all variables.

source§

impl<P, C, V: Eq + Hash> App<P, Args<Term<C, V>>>

source

pub fn fresh_vars<W>( self, map: &mut HashMap<V, W>, st: &mut W::State ) -> Lit<P, C, W>where W: Clone + Fresh,

For every variable v in the literal, replace v by its corresponding mapping if one exists, otherwise replace v by a fresh variable and add a new mapping from v to it.

Trait Implementations§

source§

impl<H: Clone, A: Clone> Clone for App<H, A>

source§

fn clone(&self) -> App<H, A>

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<H: Debug, A: Debug> Debug for App<H, A>

source§

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

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

impl<H: Display, A: Display> Display for App<H, A>

source§

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

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

impl<H: Neg<Output = H>, A> Neg for App<H, A>

§

type Output = App<H, A>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl<H: PartialEq, A: PartialEq> PartialEq<App<H, A>> for App<H, A>

source§

fn eq(&self, other: &App<H, A>) -> bool

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

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

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

impl<H: Eq, A: Eq> Eq for App<H, A>

source§

impl<H, A> StructuralEq for App<H, A>

source§

impl<H, A> StructuralPartialEq for App<H, A>

Auto Trait Implementations§

§

impl<H, A> RefUnwindSafe for App<H, A>where A: RefUnwindSafe, H: RefUnwindSafe,

§

impl<H, A> Send for App<H, A>where A: Send, H: Send,

§

impl<H, A> Sync for App<H, A>where A: Sync, H: Sync,

§

impl<H, A> Unpin for App<H, A>where A: Unpin, H: Unpin,

§

impl<H, A> UnwindSafe for App<H, A>where A: UnwindSafe, H: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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.

source§

impl<T, R> Rewind<PutRewind<T, R>> for Twhere T: Rewind<R>,

source§

fn rewind(&mut self, state: PutRewind<T, R>)

Rewind to some state.
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.