Skip to main content

systemprompt_models/
macros.rs

1//! Declarative macros shared across the crate's builder types.
2//!
3//! `builder_methods!` generates fluent setter methods that wrap each
4//! field value in `Some(..)`, for builders over structs whose fields
5//! are `Option<T>`.
6
7#[macro_export]
8macro_rules! builder_methods {
9    ($( $method:ident ( $field:ident ) -> $ty:ty ),* $(,)?) => {
10        $(
11            pub fn $method(mut self, $field: $ty) -> Self {
12                self.$field = Some($field);
13                self
14            }
15        )*
16    };
17}