2024-06-18 08:03:53 +00:00
|
|
|
//! Compile Singleton struct test:
|
2022-09-02 12:09:28 +00:00
|
|
|
//!
|
|
|
|
//! Singleton flags are only allowed for input structs. If applied on any other Salsa struct compilation must fail
|
|
|
|
|
|
|
|
#[salsa::input(singleton)]
|
|
|
|
struct MyInput {
|
|
|
|
field: u32,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[salsa::tracked(singleton)]
|
2024-07-19 12:05:39 +00:00
|
|
|
struct MyTracked<'db> {
|
2022-09-02 12:09:28 +00:00
|
|
|
field: u32,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[salsa::tracked(singleton)]
|
2024-07-19 12:05:39 +00:00
|
|
|
fn create_tracked_structs(db: &dyn salsa::Database, input: MyInput) -> Vec<MyTracked> {
|
2022-09-02 12:09:28 +00:00
|
|
|
(0..input.field(db))
|
|
|
|
.map(|i| MyTracked::new(db, i))
|
|
|
|
.collect()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[salsa::accumulator(singleton)]
|
|
|
|
struct Integers(u32);
|
|
|
|
|
2024-06-18 08:03:53 +00:00
|
|
|
fn main() {}
|