mirror of
https://github.com/salsa-rs/salsa.git
synced 2024-11-28 17:42:00 +00:00
cleanup getters/setters
This commit is contained in:
parent
73a6aed554
commit
27f847545a
6 changed files with 12 additions and 24 deletions
|
@ -20,14 +20,11 @@ macro_rules! setup_input_struct {
|
|||
// Field names
|
||||
field_ids: [$($field_id:ident),*],
|
||||
|
||||
// Visibilities for field accessor methods
|
||||
field_vis: [$($field_vis:vis f),*],
|
||||
|
||||
// Names for field getter methods (typically `foo`)
|
||||
field_getter_ids: [$($field_getter_id:ident),*],
|
||||
field_getters: [$($field_getter_vis:vis $field_getter_id:ident),*],
|
||||
|
||||
// Names for field setter methods (typically `set_foo`)
|
||||
field_setter_ids: [$($field_setter_id:ident),*],
|
||||
field_setters: [$($field_setter_vis:vis $field_setter_id:ident),*],
|
||||
|
||||
// Field types
|
||||
field_tys: [$($field_ty:ty),*],
|
||||
|
@ -135,7 +132,7 @@ macro_rules! setup_input_struct {
|
|||
}
|
||||
|
||||
$(
|
||||
$field_vis fn $field_getter_id<'db, $Db>(self, db: &'db $Db) -> $zalsa::maybe_cloned_ty!($field_option, 'db, $field_ty)
|
||||
$field_getter_vis fn $field_getter_id<'db, $Db>(self, db: &'db $Db) -> $zalsa::maybe_cloned_ty!($field_option, 'db, $field_ty)
|
||||
where
|
||||
// FIXME(rust-lang/rust#65991): The `db` argument *should* have the type `dyn Database`
|
||||
$Db: ?Sized + $zalsa::Database,
|
||||
|
@ -152,7 +149,7 @@ macro_rules! setup_input_struct {
|
|||
|
||||
$(
|
||||
#[must_use]
|
||||
$field_vis fn $field_setter_id<'db, $Db>(self, db: &'db mut $Db) -> impl salsa::Setter<FieldTy = $field_ty> + 'db
|
||||
$field_setter_vis fn $field_setter_id<'db, $Db>(self, db: &'db mut $Db) -> impl salsa::Setter<FieldTy = $field_ty> + 'db
|
||||
where
|
||||
// FIXME(rust-lang/rust#65991): The `db` argument *should* have the type `dyn Database`
|
||||
$Db: ?Sized + $zalsa::Database,
|
||||
|
|
|
@ -23,11 +23,8 @@ macro_rules! setup_interned_struct {
|
|||
// Field names
|
||||
field_ids: [$($field_id:ident),*],
|
||||
|
||||
// Visibilities for field accessor methods
|
||||
field_vis: [$($field_vis:vis f),*],
|
||||
|
||||
// Names for field setter methods (typically `set_foo`)
|
||||
field_getter_ids: [$($field_getter_id:ident),*],
|
||||
field_getters: [$($field_getter_vis:vis $field_getter_id:ident),*],
|
||||
|
||||
// Field types
|
||||
field_tys: [$($field_ty:ty),*],
|
||||
|
@ -137,7 +134,7 @@ macro_rules! setup_interned_struct {
|
|||
}
|
||||
|
||||
$(
|
||||
$field_vis fn $field_getter_id<$Db>(self, db: &'db $Db) -> $zalsa::maybe_cloned_ty!($field_option, 'db, $field_ty)
|
||||
$field_getter_vis fn $field_getter_id<$Db>(self, db: &'db $Db) -> $zalsa::maybe_cloned_ty!($field_option, 'db, $field_ty)
|
||||
where
|
||||
// FIXME(rust-lang/rust#65991): The `db` argument *should* have the type `dyn Database`
|
||||
$Db: ?Sized + $zalsa::Database,
|
||||
|
|
|
@ -20,11 +20,8 @@ macro_rules! setup_tracked_struct {
|
|||
// Field names
|
||||
field_ids: [$($field_id:ident),*],
|
||||
|
||||
// Visibilities for field accessor methods
|
||||
field_vis: [$($field_vis:vis f),*],
|
||||
|
||||
// Field names
|
||||
field_getter_ids: [$($field_getter_id:ident),*],
|
||||
field_getters: [$($field_getter_vis:vis $field_getter_id:ident),*],
|
||||
|
||||
// Field types, may reference `db_lt`
|
||||
field_tys: [$($field_ty:ty),*],
|
||||
|
@ -200,7 +197,7 @@ macro_rules! setup_tracked_struct {
|
|||
}
|
||||
|
||||
$(
|
||||
$field_vis fn $field_getter_id<$Db>(&self, db: &$db_lt $Db) -> $crate::maybe_cloned_ty!($field_option, $db_lt, $field_ty)
|
||||
$field_getter_vis fn $field_getter_id<$Db>(&self, db: &$db_lt $Db) -> $crate::maybe_cloned_ty!($field_option, $db_lt, $field_ty)
|
||||
where
|
||||
// FIXME(rust-lang/rust#65991): The `db` argument *should* have the type `dyn Database`
|
||||
$Db: ?Sized + $zalsa::Database,
|
||||
|
|
|
@ -106,9 +106,8 @@ impl Macro {
|
|||
new_fn: #new_fn,
|
||||
field_options: [#(#field_options),*],
|
||||
field_ids: [#(#field_ids),*],
|
||||
field_vis: [#(#field_vis f),*],
|
||||
field_getter_ids: [#(#field_getter_ids),*],
|
||||
field_setter_ids: [#(#field_setter_ids),*],
|
||||
field_getters: [#(#field_vis #field_getter_ids),*],
|
||||
field_setters: [#(#field_vis #field_setter_ids),*],
|
||||
field_tys: [#(#field_tys),*],
|
||||
field_indices: [#(#field_indices),*],
|
||||
num_fields: #num_fields,
|
||||
|
|
|
@ -107,8 +107,7 @@ impl Macro {
|
|||
new_fn: #new_fn,
|
||||
field_options: [#(#field_options),*],
|
||||
field_ids: [#(#field_ids),*],
|
||||
field_vis: [#(#field_vis f),*],
|
||||
field_getter_ids: [#(#field_getter_ids),*],
|
||||
field_getters: [#(#field_vis #field_getter_ids),*],
|
||||
field_tys: [#(#field_tys),*],
|
||||
field_indices: [#(#field_indices),*],
|
||||
num_fields: #num_fields,
|
||||
|
|
|
@ -104,8 +104,7 @@ impl Macro {
|
|||
db_lt: #db_lt,
|
||||
new_fn: #new_fn,
|
||||
field_ids: [#(#field_ids),*],
|
||||
field_vis: [#(#field_vis f),*],
|
||||
field_getter_ids: [#(#field_getter_ids),*],
|
||||
field_getters: [#(#field_vis #field_getter_ids),*],
|
||||
field_tys: [#(#field_tys),*],
|
||||
field_indices: [#(#field_indices),*],
|
||||
id_field_indices: [#(#id_field_indices),*],
|
||||
|
|
Loading…
Reference in a new issue