> On 18 Feb 2025, at 10:00, Andreas Hindborg <a.hindb...@kernel.org> wrote: > > Implement `PartialEq` for `BStr` by comparing underlying byte slices. > > Reviewed-by: Alice Ryhl <alicer...@google.com> > Reviewed-by: Gary Guo <g...@garyguo.net> > Signed-off-by: Andreas Hindborg <a.hindb...@kernel.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.alme...@collabora.com>
- [PATCH v7 0/6] rust: extend `module!` macro with integer ... Andreas Hindborg
- [PATCH v7 4/6] rust: str: implement `strip_prefix` f... Andreas Hindborg
- Re: [PATCH v7 4/6] rust: str: implement `strip_p... Daniel Almeida
- [PATCH v7 1/6] rust: str: implement `PartialEq` for ... Andreas Hindborg
- Re: [PATCH v7 1/6] rust: str: implement `Partial... Daniel Almeida
- [PATCH v7 5/6] rust: str: add radix prefixed integer... Andreas Hindborg
- Re: [PATCH v7 5/6] rust: str: add radix prefixed... Daniel Almeida
- Re: [PATCH v7 5/6] rust: str: add radix pref... Andreas Hindborg
- Re: [PATCH v7 5/6] rust: str: add radix prefixed... Janne Grunau
- Re: [PATCH v7 5/6] rust: str: add radix pref... Miguel Ojeda
- Re: [PATCH v7 5/6] rust: str: add radix ... Andreas Hindborg
- Re: [PATCH v7 5/6] rust: str: add radix pref... Andreas Hindborg
- [PATCH v7 2/6] rust: str: implement `Index` for `BSt... Andreas Hindborg
- Re: [PATCH v7 2/6] rust: str: implement `Index` ... Daniel Almeida
- Re: [PATCH v7 2/6] rust: str: implement `Index` ... Fiona Behrens