Skip to content

Commit c0bbcc5

Browse files
committed
Ident == AsRef<str>
1 parent 3d9d6ad commit c0bbcc5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,15 @@ impl PartialEq for Ident {
521521
}
522522
}
523523

524+
impl<T> PartialEq<T> for Ident
525+
where
526+
T: ?Sized + AsRef<str>,
527+
{
528+
fn eq(&self, other: &T) -> bool {
529+
self.to_string() == other.as_ref()
530+
}
531+
}
532+
524533
impl Eq for Ident {}
525534

526535
impl PartialOrd for Ident {

0 commit comments

Comments
 (0)