Skip to content

Commit a5076d1

Browse files
file: Implement PartialEq for AttributeValue
1 parent ec015a0 commit a5076d1

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

client/src/file/api/attribute_value.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::ops::Deref;
2+
13
use serde::{Deserialize, Serialize};
24
use zbus::zvariant::Type;
35
use zeroize::{Zeroize, ZeroizeOnDrop};
@@ -26,9 +28,21 @@ impl AsRef<str> for AttributeValue {
2628
}
2729
}
2830

29-
impl std::ops::Deref for AttributeValue {
31+
impl Deref for AttributeValue {
3032
type Target = str;
3133
fn deref(&self) -> &Self::Target {
3234
self.0.as_str()
3335
}
3436
}
37+
38+
impl PartialEq<str> for AttributeValue {
39+
fn eq(&self, other: &str) -> bool {
40+
self.deref() == other
41+
}
42+
}
43+
44+
impl PartialEq<&str> for AttributeValue {
45+
fn eq(&self, other: &&str) -> bool {
46+
self.deref() == *other
47+
}
48+
}

0 commit comments

Comments
 (0)