bon-sandbox 3.9.1

Not a real crate! It's just a showcase of examples used by `bon`'s documentation to demonstrate the rustdoc output for code generated by builder macros. Don't use this crate, it doesn't follow semver at all and serves no other purpose other than linking to its docs as an example!
Documentation
//! Comprehensive example of the generated builder and its typestate API.
//!
//! The preliminary reading of [Typestate API](https://bon-rs.com/guide/typestate-api)
//! guide is recommended to understand how the pieces in this example fit together.
//!
//! This module contains a struct [`Example`] that was annotated with [`#[derive(Builder)]`](bon::Builder).
//! The config [`#[builder(state_mod(vis = "pub"))]`](https://bon-rs.com/reference/builder/top-level/state_mod)
//! was applied to make the generated builder's typestate API public and visible here in the docs.
//!
//! The following was generated by the macro:
//! - [`ExampleBuilder`] - the builder struct itself
//! - [`example_builder`] - the builder's typestate API module

/// Example struct with the `#[derive(Builder)]` annotation.
#[derive(bon::Builder)]
#[builder(state_mod(vis = "pub"))]
pub struct Example {
    required: u32,

    optional: Option<u32>,

    #[builder(default)]
    default: u32,

    #[builder(overwritable)]
    overwritable_required: u32,

    #[builder(overwritable)]
    overwritable_optional: Option<u32>,

    #[builder(overwritable, default = 2 * 2 + 3)]
    overwritable_default: u32,

    #[builder(required)]
    required_option: Option<u64>,

    /// # Errors
    ///
    /// Non-integer strings will be rejected.
    #[builder(with = |x: &str| -> Result<_, std::num::ParseIntError> { x.parse() })]
    with: u32,
}