Struct 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> Freeze for Subst<T>

§

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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
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
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.

Source§

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

Source§

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

Rewind to some state.
Source§

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

Source§

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.