[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <FB41A276-5A3A-4878-8DA6-CE0EA751E768@collabora.com>
Date: Fri, 21 Feb 2025 12:51:20 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
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>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas@...sle.eu>,
Luis Chamberlain <mcgrof@...nel.org>,
rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org,
Adam Bratschi-Kaye <ark.email@...il.com>,
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 v7 1/6] rust: str: implement `PartialEq` for `BStr`
> On 18 Feb 2025, at 10:00, Andreas Hindborg <a.hindborg@...nel.org> wrote:
>
> Implement `PartialEq` for `BStr` by comparing underlying byte slices.
>
> Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> Reviewed-by: Gary Guo <gary@...yguo.net>
> Signed-off-by: Andreas Hindborg <a.hindborg@...nel.org>
> ---
> rust/kernel/str.rs | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs
> index 28e2201604d67..002dcddf7c768 100644
> --- a/rust/kernel/str.rs
> +++ b/rust/kernel/str.rs
> @@ -108,6 +108,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
>
> --
> 2.47.0
>
>
>
Reviewed-by: Daniel Almeida <daniel.almeida@...labora.com>
Powered by blists - more mailing lists