@@ -35,7 +35,8 @@ impl fmt::Display for Attribute {
35
35
write ! ( f, "{}" , self . 0 )
36
36
}
37
37
}
38
-
38
+ // TODO: should we have way to specify an attribute as being optional
39
+ pub type Attributes = HashMap < Attribute , AttributeType > ;
39
40
use crate :: SupportedLanguages ;
40
41
pub trait Filter : HasFilterInformation {
41
42
fn parse_filter ( & self , s : & str ) -> Result < FilterFunction , String > ;
@@ -59,7 +60,7 @@ pub struct FilterInformation<Supports> {
59
60
/// what languages this filter works on
60
61
supported_languages : Supports ,
61
62
62
- attributes : HashMap < Attribute , AttributeType > ,
63
+ attributes : Attributes ,
63
64
}
64
65
65
66
impl < Supports > fmt:: Display for FilterInformation < Supports > {
@@ -90,7 +91,7 @@ impl<Supports> FilterInformation<Supports> {
90
91
}
91
92
92
93
#[ must_use]
93
- pub const fn attributes ( & self ) -> & HashMap < Attribute , AttributeType > {
94
+ pub const fn attributes ( & self ) -> & Attributes {
94
95
& self . attributes
95
96
}
96
97
@@ -112,7 +113,7 @@ pub trait HasFilterInformation {
112
113
fn description ( & self ) -> String ;
113
114
/// what languages this filter works on
114
115
fn supports ( & self ) -> Self :: Supports ;
115
- fn attributes ( & self ) -> HashMap < Attribute , AttributeType > ;
116
+ fn attributes ( & self ) -> Attributes ;
116
117
// TODO: have filter creation informaton about types and fields for uis
117
118
fn filter_info ( & self ) -> FilterInformation < Self :: Supports > {
118
119
FilterInformation {
@@ -165,7 +166,7 @@ impl<Supports> InstantiatedFilter<Supports> {
165
166
}
166
167
167
168
#[ must_use]
168
- pub const fn attributes ( & self ) -> & HashMap < Attribute , AttributeType > {
169
+ pub const fn attributes ( & self ) -> & Attributes {
169
170
self . filter_information . attributes ( )
170
171
}
171
172
0 commit comments