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 {
|
impl<T: ToString> From<T> for MenuId {
|
||||||
fn from(value: String) -> Self {
|
fn from(value: T) -> Self {
|
||||||
Self::new(value)
|
Self::new(value.to_string())
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<&str> for MenuId {
|
|
||||||
fn from(value: &str) -> Self {
|
|
||||||
Self::new(value)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 {
|
impl PartialEq<String> for MenuId {
|
||||||
fn eq(&self, other: &String) -> bool {
|
fn eq(&self, other: &String) -> bool {
|
||||||
self.0 == *other
|
self.0 == *other
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PartialEq<String> for &MenuId {
|
||||||
|
fn eq(&self, other: &String) -> bool {
|
||||||
|
self.0 == *other
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PartialEq<&String> for MenuId {
|
impl PartialEq<&String> for MenuId {
|
||||||
fn eq(&self, other: &&String) -> bool {
|
fn eq(&self, other: &&String) -> bool {
|
||||||
self.0 == **other
|
self.0 == **other
|
||||||
|
|
Loading…
Reference in a new issue