macro_rules! builder_string_setter {
($field:ident, $doc:expr) => { ... };
}Expand description
Generates a string field setter method.
Creates a setter method that accepts impl AsRef<str>, converts it to String,
wraps it in Some, and returns self for method chaining.
§Arguments
$field- The field name$doc- Documentation string for the setter
§Examples
ⓘ
impl MessageBuilder {
builder_string_setter!(name, "Sets the message name");
}
// Expands to:
// /// Sets the message name
// #[must_use = "builder method returns modified builder"]
// pub fn name(mut self, name: impl AsRef<str>) -> Self {
// self.name = Some(name.as_ref().to_string());
// self
// }