Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider supporting "UPPER CASE" #40

Closed
nmlt opened this issue Mar 4, 2023 · 14 comments
Closed

Consider supporting "UPPER CASE" #40

nmlt opened this issue Mar 4, 2023 · 14 comments

Comments

@nmlt
Copy link

nmlt commented Mar 4, 2023

There is already "Title Case" so it seems it would make sense to also support converting all letters to upper case and keeping the separator spaces.

@jplatte
Copy link
Collaborator

jplatte commented Mar 4, 2023

Can you explain what your use case is for this? I'm already not quite clear on what people use the title case conversion for.

@nmlt
Copy link
Author

nmlt commented Mar 7, 2023

I'm using heck via strum, to convert my enum names to displayable strings. In this case I have an SQL operator enum, and would like to transform GroupBy to "GROUP BY".

@jplatte
Copy link
Collaborator

jplatte commented Apr 12, 2023

I don't really have time to maintain this crate anymore (I took over after withoutboats stopped maintaining it). I suggest looking for alternatives if what is there now doesn't suit your needs.

@azaleacolburn
Copy link

I can add UPPER CASE

@jplatte
Copy link
Collaborator

jplatte commented Aug 14, 2023

What actual use case do you have for this? Is it not filled by str::to_uppercase from std?

@azaleacolburn
Copy link

Word boundaries are represented as spaces in UPPER CASE, but remain unchanged in str::to_uppercase.

@jplatte
Copy link
Collaborator

jplatte commented Aug 14, 2023

Okay, but that only answers half of my question. What's your actual use case?

@azaleacolburn
Copy link

The same as the use-case for the entire crate. Case conversion, I don't personally use this library, but someone else might want this functionality(someone clearly does).

@jplatte
Copy link
Collaborator

jplatte commented Aug 14, 2023

Oh right, something was mentioned above. @nmlt is that code open-source? I would like to understand the context better.

@azaleacolburn
Copy link

I already opened a PR with the requested features

@jplatte
Copy link
Collaborator

jplatte commented Aug 15, 2023

I know, but I'm very hesitant about merging it. I never said I would accept a PR for it. If I were to add every casing rule imaginable, the API would be flooded with things most people have never heard of and will never need. There is another PR open with dot.case and an uppercase version of the same.

@jplatte
Copy link
Collaborator

jplatte commented Aug 15, 2023

I'm sorry but for now I'll close this. There is no obvious name for uppercase with spaces (or lowercase with spaces), and I have no reason to believe that they fill a significant use case so far. They can already be emulated with the current API (although it's not as efficient as proper support) by transforming to title case and calling .to_lowercase() or .to_uppercase() afterwards.

I'm open to reading about the mentioned use case in more detail, or reading about additional use cases. But without that, I'm not accepting PRs for this and will thus close the issue.

@jplatte jplatte closed this as not planned Won't fix, can't repro, duplicate, stale Aug 15, 2023
@nmlt
Copy link
Author

nmlt commented Aug 16, 2023

Oh right, something was mentioned above. @nmlt is that code open-source? I would like to understand the context better.

The code is a mess and abandoned, but here’s my use case: https://github.com/nmlt/TeeBenchWeb/blob/fb15aaf9164d2c7902a172f28703f3570e724981/common/src/commit.rs#L11

I don’t think this will convince you, because I solved the issue with the strum macros: going from enum name “GroupBy” to “GROUP BY”.

Edit: to make the actual use case more clear: The enum represents a element in a form. To adhere to rust naming conventions and syntax the user facing “GROUP BY” string becomes “GroupBy” in the enum.

@jplatte
Copy link
Collaborator

jplatte commented Aug 16, 2023

The strum macros are somewhat interesting, so they do alread support an "uppercase" mode where there are just no spaces. That's what I meant for there not being an obvious name for this casing convention with spaces - uppercase is clearly too generic.

Anyways, if #6 is implemented this will be possible with heck. I'm not sure how strum would expose it to users though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants