Please implement impl From<Cow<'static, str>> for StyledStr #5785
Labels
A-builder
Area: Builder API
C-enhancement
Category: Raise on the bar on expectations
E-easy
Call for participation: Experience needed to fix: Easy / not much
Please complete the following tasks
Clap Version
4.5.20
Describe your use case
We have a type representing a group of arguments that we can
#[command(flatten)]
into a number of subcommands. We want to tweak the help texts for some of them, but most will use the default help text. The default help text is a&'static str
, but the tweaked versions would have to be heap allocated. Now, we'd like to avoid the heap allocations for the vast majority of help texts.Describe the solution you'd like
We'd like to use
Arg::new(..).help(maybe_modify("the default help text"))
wheremaybe_modify
returns aCow<'static, str>
.Alternatives, if applicable
The alternative is to heap allocate even the help texts we don't want to change, i.e. do
Arg::new(..).help(maybe_modify("the default help text"))
wheremaybe_modify
returns aString
. This works today, but meh.Additional Context
No response
The text was updated successfully, but these errors were encountered: