derive-new icon indicating copy to clipboard operation
derive-new copied to clipboard

Constructor with different name than "new"?

Open Boscop opened this issue 6 years ago • 1 comments

Is it possible to name the ctor differently than "new"? I have several use cases where I use the derived new only internally in my real ctor that should be used by client code. The fact that derive-new names the ctor new means I can't use that name for my handwritten ctor, but I'd like to. Could you add the feature to name it differently? E.g. #[derive(new = "new_internal")]

Boscop avatar Oct 03 '19 22:10 Boscop

We could even optionally remove the "new_" prefix entirely for enums.

arnodb avatar Jan 28 '20 09:01 arnodb