mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
rust: str: implement PartialEq for BStr
Implement `PartialEq` for `BStr` by comparing underlying byte slices. Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Gary Guo <gary@garyguo.net> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Tested-by: Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Reviewed-by: Fiona Behrens <me@kloenk.dev> Tested-by: Daniel Gomez <da.gomez@samsung.com> Link: https://lore.kernel.org/r/20250227-module-params-v3-v8-1-ceeee85d9347@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
parent
3ba83d3761
commit
3eff946dfe
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user