mirror of
https://github.com/salsa-rs/salsa.git
synced 2024-11-28 17:42:00 +00:00
344166617c
also fix name of a fn in one case
30 lines
483 B
Rust
30 lines
483 B
Rust
#[salsa::jar(db = Db)]
|
|
pub struct Jar(MyTracked, my_fn);
|
|
|
|
pub trait Db: salsa::DbWithJar<Jar> {}
|
|
|
|
#[salsa::db(Jar)]
|
|
#[derive(Default)]
|
|
struct Database {
|
|
storage: salsa::Storage<Self>,
|
|
}
|
|
|
|
impl salsa::Database for Database {}
|
|
|
|
impl Db for Database {}
|
|
|
|
#[salsa::tracked]
|
|
pub struct MyTracked {
|
|
field: u32,
|
|
}
|
|
|
|
#[salsa::tracked]
|
|
fn my_fn(db: &dyn crate::Db) {
|
|
let x = MyTracked::new(db, 22);
|
|
x.field(22);
|
|
}
|
|
|
|
fn main() {
|
|
let db = Database::default();
|
|
my_fn(&db);
|
|
}
|