mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-23 13:10:19 +00:00
23 lines
535 B
Rust
23 lines
535 B
Rust
crate trait CounterContext: salsa::BaseQueryContext {
|
|
fn increment(&self) -> usize;
|
|
}
|
|
|
|
crate trait QueryContext: CounterContext {
|
|
salsa::query_prototype! {
|
|
fn memoized() for Memoized;
|
|
fn transparent() for Transparent;
|
|
}
|
|
}
|
|
|
|
salsa::query_definition! {
|
|
crate Memoized(query: &impl QueryContext, (): ()) -> usize {
|
|
query.increment()
|
|
}
|
|
}
|
|
|
|
salsa::query_definition! {
|
|
#[storage(transparent)]
|
|
crate Transparent(query: &impl QueryContext, (): ()) -> usize {
|
|
query.increment()
|
|
}
|
|
}
|