We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa57ed3 commit 3750774Copy full SHA for 3750774
clap_builder/src/util/any_value.rs
@@ -69,6 +69,12 @@ impl PartialOrd for AnyValueId {
69
}
70
71
72
+impl PartialEq<std::any::TypeId> for AnyValueId {
73
+ fn eq(&self, other: &std::any::TypeId) -> bool {
74
+ self.type_id == *other
75
+ }
76
+}
77
+
78
impl Ord for AnyValueId {
79
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
80
self.type_id.cmp(&other.type_id)
@@ -109,4 +115,13 @@ mod test {
109
115
110
116
assert_eq!(format!("{:?}", AnyValue::new(5)), "AnyValue { inner: i32 }");
111
117
118
119
+ #[test]
120
+ fn eq_to_type_id() {
121
+ use super::*;
122
123
+ let any_value_id = AnyValueId::of::<i32>();
124
+ let type_id = std::any::TypeId::of::<i32>();
125
+ assert_eq!(any_value_id, type_id);
126
112
127
0 commit comments