salsa/salsa-2022-tests/tests
bors[bot] 8dfc578edc
Merge #360
360: Permit renaming constructors, getters and setters r=nikomatsakis a=MihailMihov

The goal is to add an option `constructor_name` to `#[salsa::input]`, `#[salsa::interned]` and `#[salsa::tracked]` that allows changing the name of the generated constructor. After that add attributes `get` and `set` to the fields which allow overriding the names of the getters and setters. In the end the following snippet should compile and work:
```rust
#[salsa::interned(constructor = from_string)]
struct MyInterned {
    #[get(text)] #[set(set_text)] #[return_ref]
    field: String,
}

impl MyInterned {
    pub fn new(db: &dyn Db, s: impl Display) -> MyInterned {
        MyInterned::from_string(db, s.to_string())
    }

    pub fn field(self, db: &dyn Db) -> &str {
        self.text(db)
    }

    pub fn set_field(self, db: &mut dyn Db, id: String) {
        self.set_text(&mut db, id)
    }
}
```

resolves #332 

Co-authored-by: Mihail Mihov <mmihov.personal@gmail.com>
2022-08-21 10:37:21 +00:00
..
compile-fail
parallel
accumulate-from-tracked-fn.rs
accumulate-reuse-workaround.rs
accumulate-reuse.rs
accumulate.rs
compile_fail.rs
cycles.rs
deletion-cascade.rs
deletion.rs
expect_reuse_field_x_of_a_tracked_struct_changes_but_fn_deponds_on_field_y.rs
expect_reuse_field_x_of_an_input_changes_but_fn_deponds_on_field_y.rs
hello_world.rs
lru.rs
mutate_in_place.rs
override_new_get_set.rs
specify_tracked_fn_in_rev_1_but_not_2.rs
tracked_fn_on_input.rs
tracked_fn_on_tracked.rs
tracked_fn_on_tracked_specify.rs
tracked_fn_read_own_entity.rs