Struct salsa::QueryTable
source · pub struct QueryTable<'me, Q>where
Q: Query,{ /* private fields */ }
Expand description
Return value from the query
method on Database
.
Gives access to various less common operations on queries.
Implementations§
source§impl<'me, Q> QueryTable<'me, Q>
impl<'me, Q> QueryTable<'me, Q>
sourcepub fn get_or_insert(
&self,
key: <<Q as Query>::Key as InternValue>::Key,
insert: impl FnOnce(Q::Value) -> Q::Key
) -> Q::Value
pub fn get_or_insert( &self, key: <<Q as Query>::Key as InternValue>::Key, insert: impl FnOnce(Q::Value) -> Q::Key ) -> Q::Value
Fetches the intern id for the given key or inserts it if it does not exist.
source§impl<'me, Q> QueryTable<'me, Q>
impl<'me, Q> QueryTable<'me, Q>
sourcepub fn new(
db: &'me <Q as QueryDb<'me>>::DynDb,
storage: &'me Q::Storage
) -> Self
pub fn new( db: &'me <Q as QueryDb<'me>>::DynDb, storage: &'me Q::Storage ) -> Self
Constructs a new QueryTable
.
sourcepub fn get(&self, key: Q::Key) -> Q::Value
pub fn get(&self, key: Q::Key) -> Q::Value
Execute the query on a given input. Usually it’s easier to invoke the trait method directly. Note that for variadic queries (those with no inputs, or those with more than one input) the key will be a tuple.
sourcepub fn purge(&self)where
Q::Storage: QueryStorageMassOps,
pub fn purge(&self)where
Q::Storage: QueryStorageMassOps,
Completely clears the storage for this query.
This method breaks internal invariants of salsa, so any further queries might return nonsense results. It is useful only in very specific circumstances – for example, when one wants to observe which values dropped together with the table
Trait Implementations§
source§impl<Q> DebugQueryTable for QueryTable<'_, Q>
impl<Q> DebugQueryTable for QueryTable<'_, Q>
source§fn durability(&self, key: Q::Key) -> Durability
fn durability(&self, key: Q::Key) -> Durability
Returns a lower bound on the durability for the given key.
This is typically the minimum durability of all values that
the query accessed, but we may return a lower durability in
some cases.
Auto Trait Implementations§
impl<'me, Q> Freeze for QueryTable<'me, Q>
impl<'me, Q> RefUnwindSafe for QueryTable<'me, Q>
impl<'me, Q> Send for QueryTable<'me, Q>
impl<'me, Q> Sync for QueryTable<'me, Q>
impl<'me, Q> Unpin for QueryTable<'me, Q>
impl<'me, Q> UnwindSafe for QueryTable<'me, Q>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more