Introduce `#[derive(Setters, Getters)]` to derive simple accessor methods

Open
#147 2 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
rust
Domain
devtools

Research direction

Start by studying the prior art linked in the issue, especially getset, derive_getters, and derive_setters, then review bon's builder derives and macros. Done means agreeing on the accessor API and its integration with the builder feature; the issue explicitly postpones implementation until that design work is complete.

Written by the indexing model from the issue text.

Description

design needed feature request

This is based on feature requests #24 and #69.

Once we have a feature-complete builder derive we may add a feature to derive the getter/setter methods directly on the structs/enums.

This will effectively be our wheel that reimplements the features from the getset crate and other alternative crates derive_getters, derive_setters.

Note that I'm not yet ready to invest effort into the design of this feature yet. It requires studying the prior art of the getset crate first and then determining how this can be integrated into bon, how this may interact with the builder feature etc. It's a big design effort, that I'd rather postpone to the time when the builder derives/macros are feature complete.

A note for the community from the maintainers

Please vote on this issue by adding a 👍 reaction to help the maintainers with prioritizing it. You may add a comment describing your real use case related to this issue for us to better understand the problem domain.

Dominant language
Rust
Stars
2.1k
Forks
46
Avg merge
53m
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from elastio/bon

All issues in elastio/bon

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.