@@ -32,27 +32,27 @@ impl FromCowStr for ::string_cache::Atom {
32
32
}
33
33
34
34
macro_rules! with_bounds {
35
- ( $( $HeapSizeOf : tt ) * ) => {
35
+ ( $( $CommonBounds : tt ) * ) => {
36
36
/// This trait allows to define the parser implementation in regards
37
37
/// of pseudo-classes/elements
38
38
pub trait SelectorImpl : Sized + Debug {
39
- type AttrValue : Clone + Display + Eq + FromCowStr + Hash $ ( $HeapSizeOf ) * ;
40
- type Identifier : Clone + Display + Eq + FromCowStr + Hash + BloomHash $ ( $HeapSizeOf ) * ;
41
- type ClassName : Clone + Display + Eq + FromCowStr + Hash + BloomHash $ ( $HeapSizeOf ) * ;
42
- type LocalName : Clone + Display + Eq + FromCowStr + Hash + BloomHash $ ( $HeapSizeOf ) *
39
+ type AttrValue : $ ( $CommonBounds ) * + Display + FromCowStr ;
40
+ type Identifier : $ ( $CommonBounds ) * + Display + FromCowStr + BloomHash ;
41
+ type ClassName : $ ( $CommonBounds ) * + Display + FromCowStr + BloomHash ;
42
+ type LocalName : $ ( $CommonBounds ) * + Display + FromCowStr + BloomHash
43
43
+ Borrow <Self :: BorrowedLocalName >;
44
- type NamespaceUrl : Clone + Display + Eq + Default + Hash + BloomHash $ ( $HeapSizeOf ) *
44
+ type NamespaceUrl : $ ( $CommonBounds ) * + Display + Default + BloomHash
45
45
+ Borrow <Self :: BorrowedNamespaceUrl >;
46
- type NamespacePrefix : Clone + Display + Eq + Default + Hash + FromCowStr $ ( $HeapSizeOf ) * ;
46
+ type NamespacePrefix : $ ( $CommonBounds ) * + Display + Default + FromCowStr ;
47
47
type BorrowedNamespaceUrl : ?Sized + Eq ;
48
48
type BorrowedLocalName : ?Sized + Eq + Hash ;
49
49
50
50
/// non tree-structural pseudo-classes
51
51
/// (see: https://drafts.csswg.org/selectors/#structural-pseudos)
52
- type NonTSPseudoClass : Clone + Eq + Hash + PartialEq + Sized + ToCss $ ( $HeapSizeOf ) * ;
52
+ type NonTSPseudoClass : $ ( $CommonBounds ) * + Sized + ToCss ;
53
53
54
54
/// pseudo-elements
55
- type PseudoElement : Sized + PartialEq + Eq + Clone + Hash + ToCss $ ( $HeapSizeOf ) * ;
55
+ type PseudoElement : $ ( $CommonBounds ) * + Sized + ToCss ;
56
56
57
57
/// Declares if the following "attribute exists" selector is considered
58
58
/// "common" enough to be shareable. If that's not the case, when matching
@@ -86,11 +86,17 @@ macro_rules! with_bounds {
86
86
}
87
87
}
88
88
89
+ macro_rules! with_heap_size_bound {
90
+ ( $( $HeapSizeOf: tt ) * ) => {
91
+ with_bounds!( Clone + Eq + Hash $( $HeapSizeOf) * ) ;
92
+ }
93
+ }
94
+
89
95
#[ cfg( feature = "heap_size" ) ]
90
- with_bounds ! ( + :: heapsize:: HeapSizeOf ) ;
96
+ with_heap_size_bound ! ( + :: heapsize:: HeapSizeOf ) ;
91
97
92
98
#[ cfg( not( feature = "heap_size" ) ) ]
93
- with_bounds ! ( ) ;
99
+ with_heap_size_bound ! ( ) ;
94
100
95
101
pub struct ParserContext < Impl : SelectorImpl > {
96
102
pub in_user_agent_stylesheet : bool ,
0 commit comments