You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 1, 2022. It is now read-only.
I find the signature of methods like App::about not super useful. It's probably fine when doing everything statically, because you could easily make sure that the string provided outlives the App object (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 App object or even boxing the string up just to leak it.
The text was updated successfully, but these errors were encountered:
Issue by d-e-s-o
Sunday Oct 04, 2020 at 18:26 GMT
Originally opened as clap-rs/clap#2150
I find the signature of methods like
App::about
not super useful. It's probably fine when doing everything statically, because you could easily make sure that the string provided outlives theApp
object (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 theApp
object or even boxing the string up just to leak it.The text was updated successfully, but these errors were encountered: