Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

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