Struct stateright::RewritePlan

source ·
pub struct RewritePlan<R, S> { /* private fields */ }
Expand description

A RewritePlan<R> is derived from a data structure instance and indicates how values of type R (short for “rewritten”) should be rewritten. When that plan is recursively applied via Rewrite, the resulting data structure instance will be behaviorally equivalent to the original data structure under a symmetry equivalence relation, enabling symmetry reduction.

Typically the RewritePlan would be constructed by an implementation of Representative for Model::State.

Implementations§

source§

impl<R, S> RewritePlan<R, S>

source

pub fn rewrite(&self, x: &R) -> R

Applies the rewrite plan to a value of type R

source

pub fn get_state(&self) -> &S

Returns the state. Useful for debugging

source

pub fn new(s: S, f: fn(_: &R, _: &S) -> R) -> Self

Creates a new rewrite plan from a given state and function

source§

impl<R> RewritePlan<R, DenseNatMap<R, R>>where R: From<usize> + Copy, usize: From<R>,

source

pub fn from_values_to_sort<'a, V>( to_sort: impl IntoIterator<Item = &'a V> ) -> Selfwhere R: From<usize>, usize: From<R>, V: Ord + 'a,

Constructs a RewritePlan by sorting values in a specified iterator. Favor using the RewritePlan::new constructor over this one as it provides additional type safety.

source

pub fn reindex<C>(&self, indexed: &C) -> Cwhere C: Index<usize> + FromIterator<C::Output>, C::Output: Rewrite<R> + Sized,

Permutes the elements of a Vec-like collection whose indices correspond with the indices of the Vec-like that was used to construct this RewritePlan.

Trait Implementations§

source§

impl<R, S> Debug for RewritePlan<R, S>where S: Debug,

source§

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

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

impl<R, V> From<&DenseNatMap<R, V>> for RewritePlan<R, DenseNatMap<R, R>>where R: From<usize> + Copy, usize: From<R>, V: Ord,

source§

fn from(s: &DenseNatMap<R, V>) -> Self

Converts to this type from the input type.
source§

impl<R, V> From<DenseNatMap<R, V>> for RewritePlan<R, DenseNatMap<R, R>>where R: From<usize> + Copy, usize: From<R>, V: Ord,

source§

fn from(s: DenseNatMap<R, V>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<R, S> RefUnwindSafe for RewritePlan<R, S>where S: RefUnwindSafe,

§

impl<R, S> Send for RewritePlan<R, S>where S: Send,

§

impl<R, S> Sync for RewritePlan<R, S>where S: Sync,

§

impl<R, S> Unpin for RewritePlan<R, S>where S: Unpin,

§

impl<R, S> UnwindSafe for RewritePlan<R, S>where S: 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, 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.
§

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

§

fn vzip(self) -> V