pub trait ApplyCache<M: Manager, O: Copy>: DropWith<M::Edge> {
// Required methods
fn get_with_numeric(
&self,
manager: &M,
operator: O,
operands: &[Borrowed<'_, M::Edge>],
numeric_operands: &[u32],
) -> Option<M::Edge>;
fn add_with_numeric(
&self,
manager: &M,
operator: O,
operands: &[Borrowed<'_, M::Edge>],
numeric_operands: &[u32],
value: Borrowed<'_, M::Edge>,
);
fn clear(&self, manager: &M);
// Provided methods
fn get(
&self,
manager: &M,
operator: O,
operands: &[Borrowed<'_, M::Edge>],
) -> Option<M::Edge> { ... }
fn add(
&self,
manager: &M,
operator: O,
operands: &[Borrowed<'_, M::Edge>],
value: Borrowed<'_, M::Edge>,
) { ... }
}
Expand description
Cache for the result of apply operations
This trait provides methods to add computation results to the apply cache and to query the cache for these results. Just as every cache, the implementation may decide to evict results from the cache.
Required Methods§
Sourcefn get_with_numeric(
&self,
manager: &M,
operator: O,
operands: &[Borrowed<'_, M::Edge>],
numeric_operands: &[u32],
) -> Option<M::Edge>
fn get_with_numeric( &self, manager: &M, operator: O, operands: &[Borrowed<'_, M::Edge>], numeric_operands: &[u32], ) -> Option<M::Edge>
Get the result of operation
, if cached
Sourcefn add_with_numeric(
&self,
manager: &M,
operator: O,
operands: &[Borrowed<'_, M::Edge>],
numeric_operands: &[u32],
value: Borrowed<'_, M::Edge>,
)
fn add_with_numeric( &self, manager: &M, operator: O, operands: &[Borrowed<'_, M::Edge>], numeric_operands: &[u32], value: Borrowed<'_, M::Edge>, )
Add the result of operation
to this cache
An implementation is free to not cache any result. (This is why we use
Borrowed<M::Edge>
, which in this case elides a few clone and drop
operations.) If the cache already contains a key equal to operation
,
there is no need to update its value. (Again, we can elide clone and
drop operations.)
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.