frozenlib / parse-display

Procedural macro to implement Display and FromStr using common settings.
Apache License 2.0
182 stars 14 forks source link

New display style: Human Case #18

Closed hellow554 closed 3 years ago

hellow554 commented 3 years ago

I would like to see a "Human Case", where instead of using a _ or - as seperator I'd like to have a (space, 0x20, ...).

Example:

#[derive(Display, FromStr, PartialEq, Debug)]
enum StyleExample {
  #[display(style = "Human Case")]
  VarH,
}

assert_eq!(StyleExample::VarH.to_string(), "Var H");
frozenlib commented 3 years ago

Thanks for posting the issue.

I would like to avoid using terms that are not common. Could you please tell me the origin of the term "Human Case", if any?

If there is no origin, then heck crate uses the term "Title Case", and I would like to match it.

hellow554 commented 3 years ago

Could you please tell me the origin of the term "Human Case", if any?

There isn't any. I just searched a word that could describe my intention :D

If "Tile Case" is the "official" term I don't mind using it.

frozenlib commented 3 years ago

For now, I've made ‘[#display(style = "Title Case")]‘ available with 8cfd5b0a78ec60f5a879e22a9b9526a738ccd5a8 & 7a178be6397820847db533873074d6846d849f3b.

If you find a more appropriate style name, please let me know.

hellow554 commented 3 years ago

Wow, amazing! This issue can be closed.

Thanks a lot for the quick and easy work! :heart:

hellow554 commented 3 years ago

One thing:

https://github.com/frozenlib/parse-display/blob/7a178be6397820847db533873074d6846d849f3b/parse-display-derive/src/lib.rs#L807-L817

Would you like to add TITLE CASE, Title case and title case as well?

frozenlib commented 3 years ago

Thanks.

It certainly looks like I should add it. I've fixed it now in 4893a8a536714d1e8440be47d727990bc9978a20.

frozenlib commented 3 years ago

Oops.

title case is now title Case, so I'll fix that right away.