@@ -128,12 +128,20 @@ impl Context {
128
128
ExchangeRatesCache :: set_from_xml ( xml_content) ;
129
129
}
130
130
131
- pub fn variable_names ( & self ) -> & [ String ] {
132
- & self . prefix_transformer . variable_names
131
+ pub fn variable_names ( & self ) -> impl Iterator < Item = String > + ' _ {
132
+ self . prefix_transformer
133
+ . variable_names
134
+ . iter ( )
135
+ . filter ( |name| !name. starts_with ( '_' ) )
136
+ . cloned ( )
133
137
}
134
138
135
- pub fn function_names ( & self ) -> & [ String ] {
136
- & self . prefix_transformer . function_names
139
+ pub fn function_names ( & self ) -> impl Iterator < Item = String > + ' _ {
140
+ self . prefix_transformer
141
+ . function_names
142
+ . iter ( )
143
+ . filter ( |name| !name. starts_with ( '_' ) )
144
+ . cloned ( )
137
145
}
138
146
139
147
pub fn unit_names ( & self ) -> & [ Vec < String > ] {
@@ -145,13 +153,13 @@ impl Context {
145
153
}
146
154
147
155
pub fn print_environment ( & self ) -> Markup {
148
- let mut functions = Vec :: from ( self . function_names ( ) ) ;
156
+ let mut functions: Vec < _ > = self . function_names ( ) . collect ( ) ;
149
157
functions. sort ( ) ;
150
158
let mut dimensions = Vec :: from ( self . dimension_names ( ) ) ;
151
159
dimensions. sort ( ) ;
152
160
let mut units = Vec :: from ( self . unit_names ( ) ) ;
153
161
units. sort ( ) ;
154
- let mut variables = Vec :: from ( self . variable_names ( ) ) ;
162
+ let mut variables: Vec < _ > = self . variable_names ( ) . collect ( ) ;
155
163
variables. sort ( ) ;
156
164
157
165
let mut output = m:: empty ( ) ;
@@ -179,15 +187,15 @@ impl Context {
179
187
}
180
188
181
189
pub fn print_functions ( & self ) -> Markup {
182
- self . print_sorted ( self . function_names ( ) . into ( ) , FormatType :: Identifier )
190
+ self . print_sorted ( self . function_names ( ) . collect ( ) , FormatType :: Identifier )
183
191
}
184
192
185
193
pub fn print_dimensions ( & self ) -> Markup {
186
194
self . print_sorted ( self . dimension_names ( ) . into ( ) , FormatType :: TypeIdentifier )
187
195
}
188
196
189
197
pub fn print_variables ( & self ) -> Markup {
190
- self . print_sorted ( self . variable_names ( ) . into ( ) , FormatType :: Identifier )
198
+ self . print_sorted ( self . variable_names ( ) . collect ( ) , FormatType :: Identifier )
191
199
}
192
200
193
201
pub fn print_units ( & self ) -> Markup {
0 commit comments