mirror of
https://github.com/italicsjenga/muda.git
synced 2024-12-23 12:01:31 +11:00
feat: add missing PartialEq
impls and blanket From
impl for MenuId
(#100)
This commit is contained in:
parent
33168fa0a0
commit
1a527e8708
5
.changes/menu-id-impls.md
Normal file
5
.changes/menu-id-impls.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"muda": "patch"
|
||||
---
|
||||
|
||||
Add `PartialEq<&str> for &MenuId` and `PartialEq<String> for &MenuId` implementations. Also add a blanket `From<T> for MenuId` where `T: ToString` implementation.
|
|
@ -17,15 +17,9 @@ impl AsRef<str> for MenuId {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<String> for MenuId {
|
||||
fn from(value: String) -> Self {
|
||||
Self::new(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for MenuId {
|
||||
fn from(value: &str) -> Self {
|
||||
Self::new(value)
|
||||
impl<T: ToString> From<T> for MenuId {
|
||||
fn from(value: T) -> Self {
|
||||
Self::new(value.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,12 +37,24 @@ impl PartialEq<&str> for MenuId {
|
|||
}
|
||||
}
|
||||
|
||||
impl PartialEq<&str> for &MenuId {
|
||||
fn eq(&self, other: &&str) -> bool {
|
||||
self.0 == *other
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<String> for MenuId {
|
||||
fn eq(&self, other: &String) -> bool {
|
||||
self.0 == *other
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<String> for &MenuId {
|
||||
fn eq(&self, other: &String) -> bool {
|
||||
self.0 == *other
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<&String> for MenuId {
|
||||
fn eq(&self, other: &&String) -> bool {
|
||||
self.0 == **other
|
||||
|
|
Loading…
Reference in a new issue