File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -264,20 +264,15 @@ impl AssetPool {
264264 self . iter ( ) . filter ( |asset| asset. region_id == * region_id)
265265 }
266266
267- /// Iterate over only the active assets in a given region that produce or consume a given
268- /// commodity
267+ /// Iterate over the active assets in a given region that produce/ consume a commodity with the
268+ /// associated process flow
269269 pub fn iter_for_region_and_commodity < ' a > (
270270 & ' a self ,
271271 region_id : & ' a RegionID ,
272272 commodity_id : & ' a CommodityID ,
273- ) -> impl Iterator < Item = & ' a AssetRef > {
274- self . iter_for_region ( region_id) . filter ( |asset| {
275- asset. process . contains_commodity_flow (
276- commodity_id,
277- & asset. region_id ,
278- asset. commission_year ,
279- )
280- } )
273+ ) -> impl Iterator < Item = ( & ' a AssetRef , & ' a ProcessFlow ) > {
274+ self . iter_for_region ( region_id)
275+ . filter_map ( |asset| Some ( ( asset, asset. get_flow ( commodity_id) ?) ) )
281276 }
282277
283278 /// Replace the active pool with new and/or already commissioned assets
You can’t perform that action at this time.
0 commit comments