Skip to content

Commit

Permalink
Document builder(attrs(...))
Browse files Browse the repository at this point in the history
This is hard to demonstrate without importing some other crate whose
attributes can be used.  Choose serde.
  • Loading branch information
ijackson committed Mar 7, 2022
1 parent def49c5 commit dccbbb8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions derive_builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ derive_builder_macro = { version = "=0.10.2", path = "../derive_builder_macro" }
pretty_assertions = "0.6.1"
rustversion = "1.0.4"
trybuild = "1.0.38"
serde = "1"
17 changes: 17 additions & 0 deletions derive_builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,23 @@
//! # fn main() {}
//! ```
//!
//! ### Additional attributes on fields in the builder
//!
//! You can set other attributes on the field in the builder:
//!
//! ```rust
//! # #[macro_use]
//! # extern crate derive_builder;
//! #
//! #[derive(Builder)]
//! #[builder(derive(serde::Deserialize))]
//! struct Lorem {
//! #[builder(attrs(serde(rename="dolor")))]
//! ipsum: String,
//! }
//! # fn main() {}
//! ```
//!
//! # **`#![no_std]`** Support (on Nightly)
//!
//! You can activate support for `#![no_std]` by adding `#[builder(no_std)]` to your struct
Expand Down

0 comments on commit dccbbb8

Please sign in to comment.