[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250115193504.4d7c3367.gary@garyguo.net>
Date: Wed, 15 Jan 2025 19:35:04 +0000
From: Gary Guo <gary@...yguo.net>
To: Andreas Hindborg <a.hindborg@...nel.org>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, Benno Lossin <benno.lossin@...ton.me>, Alice
Ryhl <aliceryhl@...gle.com>, Masahiro Yamada <masahiroy@...nel.org>, Nathan
Chancellor <nathan@...nel.org>, Nicolas Schier <nicolas@...sle.eu>, Luis
Chamberlain <mcgrof@...nel.org>, Trevor Gross <tmgross@...ch.edu>, Adam
Bratschi-Kaye <ark.email@...il.com>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-kbuild@...r.kernel.org, Petr Pavlu
<petr.pavlu@...e.com>, Sami Tolvanen <samitolvanen@...gle.com>, Daniel
Gomez <da.gomez@...sung.com>, Simona Vetter <simona.vetter@...ll.ch>, Greg
KH <gregkh@...uxfoundation.org>, linux-modules@...r.kernel.org
Subject: Re: [PATCH v4 1/4] rust: str: implement `PartialEq` for `BStr`
On Thu, 09 Jan 2025 11:54:56 +0100
Andreas Hindborg <a.hindborg@...nel.org> wrote:
> Implement `PartialEq` for `BStr` by comparing underlying byte slices.
>
> Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> Signed-off-by: Andreas Hindborg <a.hindborg@...nel.org>
Reviewed-by: Gary Guo <gary@...yguo.net>
> ---
> rust/kernel/str.rs | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs
> index d04c12a1426d1c1edeb88325bcd9c63bf45f9b60..c441acf76ebd1f14919b6d233edffbbbbf944619 100644
> --- a/rust/kernel/str.rs
> +++ b/rust/kernel/str.rs
> @@ -106,6 +106,12 @@ fn deref(&self) -> &Self::Target {
> }
> }
>
> +impl PartialEq for BStr {
> + fn eq(&self, other: &Self) -> bool {
> + self.deref().eq(other.deref())
> + }
> +}
> +
> /// Creates a new [`BStr`] from a string literal.
> ///
> /// `b_str!` converts the supplied string literal to byte string, so non-ASCII
>
Powered by blists - more mailing lists