@@ -35,7 +35,8 @@ impl fmt::Display for Attribute {
3535 write ! ( f, "{}" , self . 0 )
3636 }
3737}
38-
38+ // TODO: should we have way to specify an attribute as being optional
39+ pub type Attributes = HashMap < Attribute , AttributeType > ;
3940use crate :: SupportedLanguages ;
4041pub trait Filter : HasFilterInformation {
4142 fn parse_filter ( & self , s : & str ) -> Result < FilterFunction , String > ;
@@ -59,7 +60,7 @@ pub struct FilterInformation<Supports> {
5960 /// what languages this filter works on
6061 supported_languages : Supports ,
6162
62- attributes : HashMap < Attribute , AttributeType > ,
63+ attributes : Attributes ,
6364}
6465
6566impl < Supports > fmt:: Display for FilterInformation < Supports > {
@@ -90,7 +91,7 @@ impl<Supports> FilterInformation<Supports> {
9091 }
9192
9293 #[ must_use]
93- pub const fn attributes ( & self ) -> & HashMap < Attribute , AttributeType > {
94+ pub const fn attributes ( & self ) -> & Attributes {
9495 & self . attributes
9596 }
9697
@@ -112,7 +113,7 @@ pub trait HasFilterInformation {
112113 fn description ( & self ) -> String ;
113114 /// what languages this filter works on
114115 fn supports ( & self ) -> Self :: Supports ;
115- fn attributes ( & self ) -> HashMap < Attribute , AttributeType > ;
116+ fn attributes ( & self ) -> Attributes ;
116117 // TODO: have filter creation informaton about types and fields for uis
117118 fn filter_info ( & self ) -> FilterInformation < Self :: Supports > {
118119 FilterInformation {
@@ -165,7 +166,7 @@ impl<Supports> InstantiatedFilter<Supports> {
165166 }
166167
167168 #[ must_use]
168- pub const fn attributes ( & self ) -> & HashMap < Attribute , AttributeType > {
169+ pub const fn attributes ( & self ) -> & Attributes {
169170 self . filter_information . attributes ( )
170171 }
171172
0 commit comments