1#![macro_use]
2
3macro_rules! gen_setter {
6 ($target:ty, $field:ident : into $t:ty) => {
7 impl $target {
8 pub fn $field<T: Into<$t>>(mut self, value: T) -> $target {
10 self.$field = value.into();
11 self
12 }
13 }
14 };
15 ($target:ty, $field:ident : val $t:ty) => {
16 impl $target {
17 pub fn $field(mut self, value: $t) -> $target {
19 self.$field = value;
20 self
21 }
22 }
23 }
24}
25
26macro_rules! gen_setters {
27 ($target:ty, $($field:ident : $k:tt $tpe:ty),+) => ($(
28 gen_setter! { $target, $field : $k $tpe }
29 )+)
30}