/ clap Public
Consider accepting a Cow instead of Into<&'b str> in App::about #2150
Area: Builder API
Category: Raise on the bar on expectations
Call for participation: Experience needed to fix: Medium / intermediate
Meta: Implementing or merging this will introduce a breaking change.
I find the signature of methods like
App::aboutnot super useful. It's probably fine when doing everything statically, because you could easily make sure that the string provided outlives the
Appobject (because most of the time you have a 'static string anyway as everything is defined statically in the code). But consider the case where you'd want to add subcommands dynamically at runtime. It gets unnecessarily unwieldy now, in my opinion, because of the lifetime requirement.
Couldn't you instead accept a
Cow<'b, str>? This way, users that do something more dynamic would at least have the possibility to fudge that with a dynamic memory allocation at the call site, instead of doing some dance to make the generated string outlive the
Appobject or even boxing the string up just to leak it.
The text was updated successfully, but these errors were encountered: