Struct salsa::QueryTableMut
source · pub struct QueryTableMut<'me, Q>where
Q: Query + 'me,{ /* private fields */ }
Expand description
Return value from the query_mut
method on Database
.
Gives access to the set
method, notably, that is used to
set the value of an input query.
Implementations§
source§impl<'me, Q> QueryTableMut<'me, Q>where
Q: Query,
impl<'me, Q> QueryTableMut<'me, Q>where
Q: Query,
sourcepub fn new(runtime: &'me mut Runtime, storage: &'me Q::Storage) -> Self
pub fn new(runtime: &'me mut Runtime, storage: &'me Q::Storage) -> Self
Constructs a new QueryTableMut
.
sourcepub fn set(&mut self, key: Q::Key, value: Q::Value)where
Q::Storage: InputQueryStorageOps<Q>,
pub fn set(&mut self, key: Q::Key, value: Q::Value)where
Q::Storage: InputQueryStorageOps<Q>,
Assign a value to an “input query”. Must be used outside of an active query computation.
If you are using snapshot
, see the notes on blocking
and cancellation on the query_mut
method.
sourcepub fn set_with_durability(
&mut self,
key: Q::Key,
value: Q::Value,
durability: Durability
)where
Q::Storage: InputQueryStorageOps<Q>,
pub fn set_with_durability(
&mut self,
key: Q::Key,
value: Q::Value,
durability: Durability
)where
Q::Storage: InputQueryStorageOps<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.
If you are using snapshot
, see the notes on blocking
and cancellation on the query_mut
method.
sourcepub fn set_lru_capacity(&self, cap: usize)where
Q::Storage: LruQueryStorageOps,
pub fn set_lru_capacity(&self, cap: usize)where
Q::Storage: LruQueryStorageOps,
Sets the size of LRU cache of values for this query table.
That is, at most cap
values will be preset in the table at the same
time. This helps with keeping maximum memory usage under control, at the
cost of potential extra recalculations of evicted values.
If cap
is zero, all values are preserved, this is the default.
sourcepub fn invalidate(&mut self, key: &Q::Key)where
Q::Storage: DerivedQueryStorageOps<Q>,
pub fn invalidate(&mut self, key: &Q::Key)where
Q::Storage: DerivedQueryStorageOps<Q>,
Marks the computed value as outdated.
This causes salsa to re-execute the query function on the next access to the query, even if all dependencies are up to date.
This is most commonly used as part of the on-demand input pattern.
Auto Trait Implementations§
impl<'me, Q> Freeze for QueryTableMut<'me, Q>
impl<'me, Q> RefUnwindSafe for QueryTableMut<'me, Q>
impl<'me, Q> Send for QueryTableMut<'me, Q>
impl<'me, Q> !Sync for QueryTableMut<'me, Q>
impl<'me, Q> Unpin for QueryTableMut<'me, Q>
impl<'me, Q> !UnwindSafe for QueryTableMut<'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
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>
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>
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