state_mod
​
Applies to: structs functions methods
Overrides name, visibility and docs for the builder's typestate API module.
Short syntax configures just the name.
attr
#[builder(state_mod = custom_name)]
Long syntax provides more flexibility. All keys are optional.
attr
#[builder(
state_mod(
name = custom_name,
vis = "pub(crate)",
doc {
/// Custom docs
}
)
)]
name
​
The default name for the builder typestate API module is a snake_case
version from the name of the builder_type
.
vis
​
The visibility must be enclosed with quotes. Use ""
or "pub(self)"
for private visibility.
The default visibility is private. This ensures the builder's type can not be named outside of the module where it was generated. See the Typestate API guide for details.
doc
​
Simple documentation is generated by default. The syntax of this attribute expects a block with doc comments.
attr
doc {
/// Doc comments
}