Skip to main content

ActionCache

Struct ActionCache 

Source
pub struct ActionCache<O: DenseId, A: AuIds = AuIds31, M: MultiplicityLike = Multiplicity> { /* private fields */ }
Expand description

The action cache: maps class pair (l, r) to a list of actions. Semi-persistent: the index map (AppendOnlyVec + SpMap) is append-only and provides branch genealogy for tokens. The values vec grows in lockstep and is truncated on restore. Actions are deterministic from the immutable snapshot, so re-derivation after restore is cheap (cache is a performance optimization, not a correctness requirement).

Implementations§

Source§

impl<O: DenseId, A: AuIds, M: MultiplicityLike> ActionCache<O, A, M>

Source

pub fn new(a_max: usize) -> Self

Source

pub fn without_ac_actions(a_max: usize) -> Self

A cache whose generate_actions skips AC/ACI matrix materialization. Used by the exact solver, which handles those operators by transport.

Source

pub fn include_ac(&self) -> bool

Source

pub fn get(&self, l: A::Class, r: A::Class) -> Option<&[Action<O, A, M>]>

Source

pub fn insert( &mut self, l: A::Class, r: A::Class, actions: Vec<Action<O, A, M>>, )

Source

pub fn a_max(&self) -> usize

Source

pub fn mark(&mut self) -> ActionCacheToken

Source

pub fn is_valid_token(&self, token: &ActionCacheToken) -> bool

Is this token restorable right now (same instance, live branch)?

Source

pub fn restore(&mut self, token: ActionCacheToken)

Trait Implementations§

Source§

impl<O: DenseId, A: AuIds, M: MultiplicityLike> Default for ActionCache<O, A, M>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<O, A, M> Freeze for ActionCache<O, A, M>
where SpMap<(<A as AuIds>::Class, <A as AuIds>::Class), <A as AuIds>::Action, <A as AuIds>::Index>: Freeze, Vec<Vec<Action<O, A, M>>>: Freeze,

§

impl<O, A, M> RefUnwindSafe for ActionCache<O, A, M>
where SpMap<(<A as AuIds>::Class, <A as AuIds>::Class), <A as AuIds>::Action, <A as AuIds>::Index>: RefUnwindSafe, Vec<Vec<Action<O, A, M>>>: RefUnwindSafe,

§

impl<O, A, M> Send for ActionCache<O, A, M>
where SpMap<(<A as AuIds>::Class, <A as AuIds>::Class), <A as AuIds>::Action, <A as AuIds>::Index>: Send, Vec<Vec<Action<O, A, M>>>: Send,

§

impl<O, A, M> Sync for ActionCache<O, A, M>
where SpMap<(<A as AuIds>::Class, <A as AuIds>::Class), <A as AuIds>::Action, <A as AuIds>::Index>: Sync, Vec<Vec<Action<O, A, M>>>: Sync,

§

impl<O, A, M> Unpin for ActionCache<O, A, M>
where SpMap<(<A as AuIds>::Class, <A as AuIds>::Class), <A as AuIds>::Action, <A as AuIds>::Index>: Unpin, Vec<Vec<Action<O, A, M>>>: Unpin,

§

impl<O, A, M> UnsafeUnpin for ActionCache<O, A, M>
where SpMap<(<A as AuIds>::Class, <A as AuIds>::Class), <A as AuIds>::Action, <A as AuIds>::Index>: UnsafeUnpin, Vec<Vec<Action<O, A, M>>>: UnsafeUnpin,

§

impl<O, A, M> UnwindSafe for ActionCache<O, A, M>
where SpMap<(<A as AuIds>::Class, <A as AuIds>::Class), <A as AuIds>::Action, <A as AuIds>::Index>: UnwindSafe, Vec<Vec<Action<O, A, M>>>: 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.