mirror of
https://github.com/salsa-rs/salsa.git
synced 2024-12-01 12:20:57 +00:00
344166617c
also fix name of a fn in one case
48 lines
1.1 KiB
Rust
48 lines
1.1 KiB
Rust
#[salsa::jar(db = Db)]
|
|
struct Jar(
|
|
MyInput,
|
|
tracked_fn_with_data,
|
|
tracked_fn_with_db,
|
|
tracked_fn_with_constructor,
|
|
tracked_fn_with_one_input,
|
|
tracked_fn_with_receiver_not_applied_to_impl_block,
|
|
tracked_fn_with_too_many_arguments_for_specify,
|
|
);
|
|
|
|
trait Db: salsa::DbWithJar<Jar> {}
|
|
|
|
#[salsa::input(jar = Jar)]
|
|
struct MyInput {
|
|
field: u32,
|
|
}
|
|
|
|
#[salsa::tracked(jar = Jar, data = Data)]
|
|
fn tracked_fn_with_data(db: &dyn Db, input: MyInput) -> u32 {
|
|
input.field(db) * 2
|
|
}
|
|
|
|
#[salsa::tracked(jar = Jar, db = Db)]
|
|
fn tracked_fn_with_db(db: &dyn Db, input: MyInput) -> u32 {
|
|
input.field(db) * 2
|
|
}
|
|
|
|
#[salsa::tracked(jar = Jar, constructor = TrackedFn3)]
|
|
fn tracked_fn_with_constructor(db: &dyn Db, input: MyInput) -> u32 {
|
|
input.field(db) * 2
|
|
}
|
|
|
|
#[salsa::tracked(jar = Jar)]
|
|
fn tracked_fn_with_one_input(db: &dyn Db) -> u32 {}
|
|
|
|
#[salsa::tracked(jar = Jar)]
|
|
fn tracked_fn_with_receiver_not_applied_to_impl_block(&self, db: &dyn Db) -> u32 {}
|
|
|
|
#[salsa::tracked(jar = Jar, specify)]
|
|
fn tracked_fn_with_too_many_arguments_for_specify(
|
|
db: &dyn Db,
|
|
input: MyInput,
|
|
input: MyInput,
|
|
) -> u32 {
|
|
}
|
|
|
|
fn main() {}
|