Skip to content
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

refactor: Improve builder api with bon #401

Closed
wants to merge 1 commit into from
Closed

Conversation

timonv
Copy link
Member

@timonv timonv commented Oct 20, 2024

No description provided.

@timonv timonv marked this pull request as draft October 20, 2024 20:21
@timonv
Copy link
Member Author

timonv commented Oct 20, 2024

It's a cool idea, but the library is not there yet, lacking building customization. Next release probably has more with custom setters, but still missing more. Perhaps check it out again in a couple of months or so.

@timonv timonv closed this Oct 20, 2024
@Veetaha
Copy link

Veetaha commented Oct 24, 2024

Hi @timonv, could you share what you'd like to see in bon that's missing now? As I understand it's the customization of setters, which is indeed comming in the next release in the form of #[builder(with = custom_closure)] and the ability to denote the builder's type and thus write a custom impl block for it.

But would be "still missing more" after that?

@timonv
Copy link
Member Author

timonv commented Oct 25, 2024

Haha hey @Veetaha that's quite the surprise. I really like where bon tries to go, more type safety is always good. This is very much personal opinion, from my side:

Custom setters is big, and similarly, I'd like to be able to just add methods to the builder, preferably in plain rust and not with macros. Maybe there's a way to make the return type nicer so that's possible, maybe a trait could work? Methods don't always map 1-1 to the type for me. I.e., I might have a method without arguments per enum value.

@Veetaha
Copy link

Veetaha commented Oct 25, 2024

I see, there is an example of how to add methods to the builder directly in this PR description elastio/bon#145. This is not released and the documentation for this feature is not ready at the moment, but it's soon to be released

@timonv
Copy link
Member Author

timonv commented Nov 4, 2024

@Veetaha Thanks! That looks really good, I'll give it another try soon. Out of curiosity, how did you find this PR? I'd love to do the same for this repository.

@Veetaha
Copy link

Veetaha commented Nov 4, 2024

Through the github search with today's date.

bon created:2024-11-04 language:Rust

image

Sometimes I use prev. week range with created:>date

There is also a dependency graph with reverse dependencies.

@timonv
Copy link
Member Author

timonv commented Nov 4, 2024

What a great idea, thanks for being so proactive <3

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