mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-08-04 02:48:38 +00:00
adopt salsa::database
attribute macro
This commit is contained in:
parent
3fc02c6c0c
commit
a8d9fb2d6b
13 changed files with 55 additions and 159 deletions
|
@ -13,6 +13,7 @@ use crate::compiler::{CompilerDatabase, Interner};
|
|||
/// to your context (e.g., a shared counter or some such thing). If
|
||||
/// mutations to that shared state affect the results of your queries,
|
||||
/// that's going to mess up the incremental results.
|
||||
#[salsa::database(class_table::ClassTableDatabase)]
|
||||
#[derive(Default)]
|
||||
pub struct DatabaseImpl {
|
||||
runtime: salsa::Runtime<DatabaseImpl>,
|
||||
|
@ -31,17 +32,6 @@ impl salsa::Database for DatabaseImpl {
|
|||
}
|
||||
}
|
||||
|
||||
/// Declares the "query storage" for your context. Here, you list out
|
||||
/// all of the query traits from your application that you wish to
|
||||
/// provide storage for. This macro will generate the appropriate
|
||||
/// storage and also generate impls for those traits, so that you
|
||||
/// `DatabaseImpl` type implements them.
|
||||
salsa::database_storage! {
|
||||
pub DatabaseImpl {
|
||||
impl class_table::ClassTableDatabase;
|
||||
}
|
||||
}
|
||||
|
||||
/// In addition to the "query provider" traits, you may have other
|
||||
/// trait requirements that your application needs -- you can
|
||||
/// implement those yourself (in this case, an `interner`).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue