Skip to content

Commit

Permalink
Document that the builder struct name can be controlled (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijackson committed Mar 8, 2022
1 parent e6f4fb8 commit a560de8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions derive_builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,25 @@
//! Otherwise precede your struct (or field) with `#[builder(private)]` to opt into private
//! setters.
//!
//! ## Generated builder struct name
//!
//! By default, the builder struct for `struct Foo` is `FooBuilder`.
//! You can override this:
//!
//! ```rust
//! # #[macro_use]
//! # extern crate derive_builder;
//! #
//! #[derive(Builder)]
//! #[builder(name = "FooConstructor")]
//! struct Foo { }
//!
//! # fn main() -> Result<(), FooConstructorError> {
//! let foo: Foo = FooConstructor::default().build()?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Setter Name/Prefix
//!
//! Setter methods are named after their corresponding field by default.
Expand Down

0 comments on commit a560de8

Please sign in to comment.