#[allow(unused_macros)]
macro_rules! get {
($($field:ident: $T:ty),* $(,)?) => {
paste::paste! {
$(
pub const fn $field(&self) -> $T {
self.$field
}
pub const fn [<$field _mut>](&mut self) -> &mut $T {
&mut self.$field
}
)*
}
};
($($field:ident: &$T:ty),* $(,)?) => {
paste::paste! {
$(
pub const fn $field(&self) -> &$T {
&self.$field
}
pub const fn [<$field _mut>](&mut self) -> &mut $T {
&mut self.$field
}
)*
}
};
}
#[allow(unused_macros)]
macro_rules! set_with {
($($field:ident: $F:ty),* $(,)?) => {
paste::paste! {
$(
pub fn [<set_ $field>](&mut self, value: $T) {
self.$field = value
}
pub fn [<with_ $field>](self, $field: $T) -> Self {
Self {
$field,
..self
}
}
)*
}
};
}