makeit icon indicating copy to clipboard operation
makeit copied to clipboard

`Buildable` trait should be removed

Open lilyball opened this issue 3 years ago • 1 comments

I love the idea of this crate for writing builder patterns, but I want the use of this crate to be transparent to end-users. The comments on the Buildable trait say it exists to handle the edge case of the type already having a builder() method. I don't really understand why this is a problem; if the type already has one, why is it using makeit? Builder isn't something that can be applied to an existing type either, it's something used on a type as it's being defined. Instead I would simply prefer an optional #[builder(method = "builder")] attribute that lets me rename the builder method. This same attribute could also be used to rename the builder type (and wrapper module) as well.

I suppose today I can implement an inherent builder() method that invokes the trait method, but that's a bit awkward and shouldn't be necessary just to let clients of my type call its builder.

lilyball avatar Mar 25 '22 22:03 lilyball

Makes sense. I'll merge any PRs that implement this.

estebank avatar Mar 28 '22 02:03 estebank