Skip to main content

builder_methods

Macro builder_methods 

Source
macro_rules! builder_methods {
    ($( $method:ident ( $field:ident ) -> $ty:ty ),* $(,)?) => { ... };
}
Expand description

Generates builder-style with_* methods for Option fields.

Each method takes self by value and returns Self, setting the field to Some(value).

ยงUsage

impl MyStruct {
    builder_methods! {
        with_name(name) -> String,
        with_status(status) -> String,
        with_limit(limit) -> i64,
    }
}