1 #![macro_use]
2 
3 //! Contains several macros used in this crate.
4 
5 macro_rules! gen_setter {
6     ($target:ty, $field:ident : into $t:ty) => {
7         impl $target {
8             /// Sets the field to the provided value and returns updated config object.
9             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             /// Sets the field to the provided value and returns updated config object.
18             pub fn $field(mut self, value: $t) -> $target {
19                 self.$field = value;
20                 self
21             }
22         }
23     }
24 }
25 
26 macro_rules! gen_setters {
27     ($target:ty, $($field:ident : $k:tt $tpe:ty),+) => ($(
28         gen_setter! { $target, $field : $k $tpe }
29     )+)
30 }
31