1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
//! Compile Singleton struct test:
//!
//! 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)]
struct MyTracked<'db> {
field: u32,
}
#[salsa::tracked(singleton)]
fn create_tracked_structs(db: &dyn salsa::Database, input: MyInput) -> Vec<MyTracked> {
(0..input.field(db))
.map(|i| MyTracked::new(db, i))
.collect()
}
#[salsa::accumulator(singleton)]
struct Integers(u32);
fn main() {}
|