From: Danilo Krummrich <dakr@redhat.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: ojeda@kernel.org, alex.gaynor@gmail.com, wedsonaf@gmail.com,
boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com,
benno.lossin@proton.me, a.hindborg@samsung.com,
aliceryhl@google.com, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: str: add to_ascii_{upper,lower}case() to CString
Date: Mon, 22 Jan 2024 23:16:37 +0100 [thread overview]
Message-ID: <Za7pRc1wTtEhObTN@cassiopeiae> (raw)
In-Reply-To: <CANiq72kdX-LK=OurnR5ZGDXEf90DxshUX13up4c8kiz0jxHc+Q@mail.gmail.com>
On Mon, Jan 22, 2024 at 08:38:26PM +0100, Miguel Ojeda wrote:
> On Mon, Jan 22, 2024 at 7:46 PM Danilo Krummrich <dakr@redhat.com> wrote:
> >
> > Add functions to convert a CString to upper- / lowercase assuming all
> > characters are ASCII encoded.
>
> Like Alice mentioned, please mention the use case, i.e. the "why?"
Sure, I need this in the context of converting stringified enum values
(representing different GPU chipsets) to strings in order to generate the
corresponding firmware paths. The project context is Nova (GSP only Rust
successor of Nouveau).
If preferred, I can add this to the commit message.
> (perhaps also linking the Zulip discussion if you like [1]).
>
> [1] https://rust-for-linux.zulipchat.com/#narrow/stream/288089-General/topic/String.20manipulation.20in.20kernel.20Rust
Sure, gonna add it.
>
> > + /// Converts the whole CString to lowercase.
>
> Please use Markdown and, if possible, an intra-doc link, i.e.
>
> /// Converts the whole [`CString`] to lowercase.
>
> Also perhaps we should mimic the standard library docs?
Mimic, as in copy them over (to the extent they actually apply)?
>
> > + pub fn to_ascii_lowercase(&mut self) {
> > + self.buf.make_ascii_lowercase();
> > + }
>
> Why did you choose the `to_ascii_*()` name for these? In the standard
> library, the in-place ones are `make_ascii_*()` (like the one you call
> in the implementation).
Should be make_ascii_*(), agreed.
>
> Should the new-object-returned ones be added, by the way, if we are
> adding these?
Sure, I'm fine adding them as well. Not sure we'll need them for Nova though.
- Danilo
>
> Cheers,
> Miguel
>
next prev parent reply other threads:[~2024-01-22 22:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 18:45 [PATCH] rust: str: add to_ascii_{upper,lower}case() to CString Danilo Krummrich
2024-01-22 18:57 ` Alice Ryhl
2024-01-22 19:35 ` Greg KH
2024-01-22 22:38 ` Danilo Krummrich
2024-01-22 23:12 ` Greg KH
2024-01-23 17:24 ` Danilo Krummrich
2024-01-23 18:18 ` Miguel Ojeda
2024-01-22 19:38 ` Miguel Ojeda
2024-01-22 22:16 ` Danilo Krummrich [this message]
2024-01-23 17:35 ` Miguel Ojeda
2024-01-25 9:08 ` Alice Ryhl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Za7pRc1wTtEhObTN@cassiopeiae \
--to=dakr@redhat.com \
--cc=a.hindborg@samsung.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=wedsonaf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).