Welcome to bon Discussions! #55
Veetaha
announced in
Announcements
Replies: 1 comment 1 reply
-
If you ask me, it would make sense for the conversions to be directly above the field they are altering. #[builder]
pub struct Sprinkles {
#[with(String, into)] // Function accepts the String type, calls String::into during assignment.
colour: Option<String>,
description: Option<String> // This is not impacted by the pattern 👍🏼
} P.S, super cool library, and one that I unfortunately found 700+ lines of builders (+ documenting said builders) too late 😭 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
👋 Welcome!
We’re using Discussions as a place to connect with other members of our community. We hope that you:
My immediate plan for
bon
's close future is to make it less magical by removing the automatic into conversions rules, which is going to require a new major release. According to #15 (comment) if you want to automatically add into conversions, you'll be able to use#[builder(on(type_pattern, into))]
. See details in the linked issue comment.I wonder what people think about this design and this change overall. Does this fit your use cases, or should the existing rules for auto into conversions still exist but under smth like
#[builder(auto_into)]
? As for me the#[builder(on(String, into))]
, looks easier to understand even though a bit more verbose.Beta Was this translation helpful? Give feedback.
All reactions