@@ -76,8 +76,10 @@ impl Sealed for Host<'static> {}
76
76
impl UniqueProperty for MediaType {
77
77
fn collides ( & self , self_route : & Route , other_route : & Route ) -> Option < bool > {
78
78
match ( self_route. method . allows_request_body ( ) , other_route. method . allows_request_body ( ) ) {
79
- ( Some ( true ) , Some ( true ) ) => other_route. get_unique_prop ( ) . map ( |other| self . collides_with ( other) ) ,
80
- _ => Some ( true ) ,
79
+ ( Some ( true ) , Some ( true ) ) => other_route
80
+ . get_unique_prop ( )
81
+ . map ( |other| self . collides_with ( other) ) ,
82
+ _ => None , // Does not differentiate routes
81
83
}
82
84
}
83
85
@@ -101,25 +103,15 @@ pub(crate) fn dyn_box_any(b: &Box<dyn UniqueProperty>) -> &dyn Any {
101
103
let any = b. as_any ( ) ;
102
104
assert_eq ! ( b. type_id( ) , any. type_id( ) ) ;
103
105
any
104
- // <Box<dyn UniqueProperty> as AsRef<dyn UniqueProperty>>::as_ref(b).as_any()
105
- // todo!()
106
106
}
107
107
108
108
/// A set of properties is unambiguous iff there is at least one property shared by both sets, with
109
109
/// a different value.
110
110
pub ( crate ) fn collides ( a : & Route , b : & Route ) -> bool {
111
111
for prop_a in & a. unique_properties {
112
- for prop_b in & b. unique_properties {
113
- // Check that they have the same type_id, which prevents checking other properties (and potentially
114
- // avoids the need to check the reverse)
115
- dbg ! ( ( prop_a. type_id( ) , prop_b. type_id( ) , prop_a. type_id( ) == prop_b. type_id( ) ) ) ;
116
- dbg ! ( prop_a. collides( a, b) ) ;
117
- // `prop_b.as_ref()` is needed to ensure we do not convert `Box<dyn _>` into `&dyn Any`, but rather
118
- // get the inner type
119
- // assert_eq!(std::any::TypeId::of::<MediaType>(), dyn_box_any(prop_b).type_id());
120
- if dyn_box_any ( prop_a) . type_id ( ) == dyn_box_any ( prop_b) . type_id ( ) && prop_a. collides ( a, b) == Some ( false ) {
121
- return false ;
122
- }
112
+ // TODO: we should consider checking the inverse, i.e., does b collide with a
113
+ if prop_a. collides ( a, b) == Some ( false ) {
114
+ return false ;
123
115
}
124
116
}
125
117
true
0 commit comments