Struct salsa::QueryTable
source · pub struct QueryTable<'me, DB, Q>where
DB: Database + 'me,
Q: Query<DB> + 'me,{ /* private fields */ }
Implementations
sourceimpl<'me, DB, Q> QueryTable<'me, DB, Q>where
DB: Database + 'me,
Q: Query<DB> + 'me,
impl<'me, DB, Q> QueryTable<'me, DB, Q>where
DB: Database + 'me,
Q: Query<DB> + 'me,
sourceimpl<DB, Q> QueryTable<'_, DB, Q>where
DB: Database,
Q: Query<DB>,
impl<DB, Q> QueryTable<'_, DB, Q>where
DB: Database,
Q: Query<DB>,
pub fn get(&self, key: Q::Key) -> Q::Value
pub fn sweep(&self, strategy: SweepStrategy)where
Q::Storage: QueryStorageMassOps<DB>,
sourcepub fn set(&self, key: Q::Key, value: Q::Value)where
Q::Storage: InputQueryStorageOps<DB, Q>,
pub fn set(&self, key: Q::Key, value: Q::Value)where
Q::Storage: InputQueryStorageOps<DB, Q>,
Assign a value to an “input query”. Must be used outside of an active query computation.
sourcepub fn set_constant(&self, key: Q::Key, value: Q::Value)where
Q::Storage: InputQueryStorageOps<DB, Q>,
pub fn set_constant(&self, key: Q::Key, value: Q::Value)where
Q::Storage: InputQueryStorageOps<DB, Q>,
Assign a value to an “input query”, with the additional promise that this value will never change. Must be used outside of an active query computation.
sourcepub fn set_unchecked(&self, key: Q::Key, value: Q::Value)where
Q::Storage: UncheckedMutQueryStorageOps<DB, Q>,
pub fn set_unchecked(&self, key: Q::Key, value: Q::Value)where
Q::Storage: UncheckedMutQueryStorageOps<DB, Q>,
Assigns a value to the query bypassing the normal incremental checking – this value becomes the value for the query in the current revision. This can even be used on “derived” queries (so long as their results are memoized).
Note that once set_unchecked
is used, the result is
effectively “fixed” for all future revisions. This “mocking”
system is pretty primitive and subject to revision; see
salsa-rs/salsa#34
for more details.
This is only meant to be used for “mocking” purposes in
tests – when testing a given query, you can use
set_unchecked
to assign the values for its various inputs
and thus control what it sees when it executes.
Trait Implementations
sourceimpl<DB, Q> DebugQueryTable for QueryTable<'_, DB, Q>where
DB: Database,
Q: Query<DB>,
impl<DB, Q> DebugQueryTable for QueryTable<'_, DB, Q>where
DB: Database,
Q: Query<DB>,
type Key = <Q as Query<DB>>::Key
sourcefn is_constant(&self, key: Q::Key) -> bool
fn is_constant(&self, key: Q::Key) -> bool
key
is a
constant, meaning that it can never change, no matter what
values the inputs take on from this point. Read more