Skip to content

Make self receiver and start_fn members available as official fields#250

Merged
Veetaha merged 6 commits intomasterfrom
feat/expose-receiver-and-start-fn-members-as-builder-fields
Mar 5, 2025
Merged

Make self receiver and start_fn members available as official fields#250
Veetaha merged 6 commits intomasterfrom
feat/expose-receiver-and-start-fn-members-as-builder-fields

Conversation

@Veetaha
Copy link
Collaborator

@Veetaha Veetaha commented Mar 5, 2025

This is according to my design decision here: #225 (comment).

Now bon generates stable names for some native private fields of the builder that are documented and accessible to bon macro users:

  • self_receiver - stores the self value of the method (for builders generated from a method)
  • {member_name} - stores the value of the member annotated with #[builder(start_fn)]. These members are initialized when the builder is created.

These native private builder fields can be freely accessed in custom setters/getters or generally within the same module scope.

@Veetaha Veetaha merged commit 72b058d into master Mar 5, 2025
27 checks passed
@Veetaha Veetaha deleted the feat/expose-receiver-and-start-fn-members-as-builder-fields branch March 5, 2025 23:12
@github-actions github-actions bot mentioned this pull request Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants