1#![macro_use]
2
3macro_rules! gen_setter {
6 ($(#[$comments:meta])* $field:ident : into $t:ty) => {
7
8 $(#[$comments])*
9 #[inline]
12 #[must_use]
13 pub fn $field<T: Into<$t>>(mut self, value: T) -> Self {
14 self.$field = value.into();
15 self
16 }
17 };
18 ($(#[$comments:meta])* $field:ident : val $t:ty) => {
19 $(#[$comments])*
20 #[inline]
23 #[must_use]
24 pub const fn $field(mut self, value: $t) -> Self {
25 self.$field = value;
26 self
27 }
28 };
29 ($(#[$comments:meta])* $field:ident : delegate $t:ty) => {
30 $(#[$comments])*
31 #[inline]
34 #[must_use]
35 pub const fn $field(mut self, value: $t) -> Self {
36 self.c.$field = value;
37 self
38 }
39 };
40 ($(#[$comments:meta])* $field:ident : c2 $t:ty) => {
41 $(#[$comments])*
42 #[inline]
45 #[must_use]
46 pub fn $field(self, value: $t) -> ParserConfig2 {
47 ParserConfig2 {
48 c: self,
49 ..Default::default()
50 }
51 .$field(value)
52 }
53 };
54}
55
56macro_rules! gen_setters {
57 ($target:ident, $($(#[$comments:meta])* $field:ident : $k:tt $tpe:ty),+) => (
58 impl $target {$(
59
60 gen_setter! { $(#[$comments])* $field : $k $tpe }
61 )+
62 })
63}