aboutsummaryrefslogtreecommitdiff
path: root/src/macros.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/macros.rs')
-rw-r--r--src/macros.rs32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/macros.rs b/src/macros.rs
index 1cce3d6..25916d3 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -5,7 +5,8 @@
macro_rules! gen_setter {
($target:ty, $field:ident : into $t:ty) => {
impl $target {
- /// Sets the field to the provided value and returns updated config object.
+ /// See [`ParserConfig`][crate::ParserConfig] fields docs for details
+ #[inline]
pub fn $field<T: Into<$t>>(mut self, value: T) -> $target {
self.$field = value.into();
self
@@ -14,13 +15,38 @@ macro_rules! gen_setter {
};
($target:ty, $field:ident : val $t:ty) => {
impl $target {
- /// Sets the field to the provided value and returns updated config object.
+ /// See [`ParserConfig`][crate::ParserConfig] fields docs for details
+ #[inline]
pub fn $field(mut self, value: $t) -> $target {
self.$field = value;
self
}
}
- }
+ };
+ ($target:ty, $field:ident : delegate $t:ty) => {
+ impl $target {
+ /// See [`ParserConfig`][crate::ParserConfig] fields docs for details
+ #[inline]
+ pub fn $field(mut self, value: $t) -> $target {
+ self.c.$field = value;
+ self
+ }
+ }
+ };
+ ($target:ty, $field:ident : c2 $t:ty) => {
+ impl $target {
+ /// See [`ParserConfig2`][crate::reader::ParserConfig] fields docs for details
+ #[inline]
+ #[must_use]
+ pub fn $field(self, value: $t) -> ParserConfig2 {
+ ParserConfig2 {
+ c: self,
+ ..Default::default()
+ }
+ .$field(value)
+ }
+ }
+ };
}
macro_rules! gen_setters {