Struct cop::Subst

source ·
pub struct Subst<T> { /* private fields */ }
Expand description

Map from variables (usize) to T that can be efficiently restored to earlier states.

Implementations§

source§

impl<T> Subst<T>

source

pub fn get_dom_len(&self) -> usize

Return the number of assigned variables.

source

pub fn get_dom_max(&self) -> usize

Return the maximally assignable index.

source

pub fn set_dom_max(&mut self, dom_max: usize)

Permit the assignment of variables at least up to (excluding) the given index.

source

pub fn set_dom_len(&mut self, new_len: usize)

Omit the most recent variable bindings to keep only the given number of bindings.

source

pub fn insert(&mut self, v: usize, tm: T)

Assign a given variable to the given term.

Panic if the index exceeds the maximum domain.

source

pub fn get(&self, v: usize) -> Option<&T>

Obtain a variable binding.

Panic if the index exceeds the maximum domain.

source§

impl<T: Copy> Subst<T>

source

pub fn fix(&self, x: T, f: impl Fn(T) -> Option<usize>) -> T

Repeatedly apply substitution to a value.

The function terminates as soon as either the given function returns no index or the substitution is not defined at the index.

Trait Implementations§

source§

impl<T> Default for Subst<T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T: Display> Display for Subst<T>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Subst<T>where T: RefUnwindSafe,

§

impl<T> Send for Subst<T>where T: Send,

§

impl<T> Sync for Subst<T>where T: Sync,

§

impl<T> Unpin for Subst<T>where T: Unpin,

§

impl<T> UnwindSafe for Subst<T>where T: 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> 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.