[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72kdX-LK=OurnR5ZGDXEf90DxshUX13up4c8kiz0jxHc+Q@mail.gmail.com>
Date: Mon, 22 Jan 2024 20:38:26 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Danilo Krummrich <dakr@...hat.com>
Cc: ojeda@...nel.org, alex.gaynor@...il.com, wedsonaf@...il.com,
boqun.feng@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
benno.lossin@...ton.me, a.hindborg@...sung.com, aliceryhl@...gle.com,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: str: add to_ascii_{upper,lower}case() to CString
On Mon, Jan 22, 2024 at 7:46 PM Danilo Krummrich <dakr@...hat.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?"
(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
> + /// 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?
> + 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 the new-object-returned ones be added, by the way, if we are
adding these?
Cheers,
Miguel
Powered by blists - more mailing lists