Skip to main content

Module component_props

Module component_props 

Source
Expand description

Rule §6.2: migrate #[derive(Default)] struct *Props to #[derive(bon::Builder)] with #[builder(default)] on optional fields.

Heuristics (matches the spec §6.2 “Mechanical” strategy):

  • Target: structs whose ident ends in Props and carry #[derive(Default)].
  • For each field whose type is Option<...>, attach #[builder(default)] — these are always optional.
  • The first non-Option field stays required (no #[builder(default)]) so Card { item: x } keeps working out of the box. Every other non-Option field gets #[builder(default)]. The developer can promote any of those back to required by deleting the attribute during review.

Structs§

Rule
component_props rule entry.