-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
I have an Displayed enum with a custom format on each variant, like this:
#[derive(Display)]
enum SomeEnum {
#[display("valuea:{0}")]
ValueA(String),
#[display("valueb:{0}")]
ValueB(String),
#[display("valuec:{0}")]
ValueC(String),
}It'd be nice to make this more readable by using the lowercase term in the format, such as #[display("{lowercase}:{0}")] or #[display("{}:{0}", lowercase)]. A drawback of the former is ambiguity if the variant contains a lowercase field (positional format args don't appear to be accepted currently), so the latter is likely the preferred form.
Even better would be this:
#[derive(Display)]
#[display("{}:{0}", lowercase)]
enum SomeEnum {
ValueA(String),
ValueB(String),
ValueC(String),
#[display(lowercase)]
Other // breaks above convention
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
No status