File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99
1010- Bump MSRV to 1.58.0
1111
12+ - ` array::names ` returns custom names if specified
13+
1214## [ v0.14.2] - 2023-04-04
1315
1416- Add support of ` a-Z ` for ` dimIndex `
Original file line number Diff line number Diff line change 5353/// Return list of names of instances in array
5454pub fn names < ' a , T : Name > ( info : & ' a T , dim : & ' a DimElement ) -> impl Iterator < Item = String > + ' a {
5555 let name = info. name ( ) ;
56- dim. indexes ( )
57- . map ( move |i| name. replace ( "[%s]" , & i) . replace ( "%s" , & i) )
56+ dim. indexes ( ) . map ( move |i| {
57+ dim. dim_array_index
58+ . as_ref ( )
59+ . map ( |dai| {
60+ dai. values
61+ . iter ( )
62+ . find ( |e| e. value . map ( |v| v. to_string ( ) . as_str ( ) == i. deref ( ) ) == Some ( true ) )
63+ } )
64+ . flatten ( )
65+ . map ( |n| n. name . clone ( ) )
66+ . unwrap_or_else ( || name. replace ( "[%s]" , & i) . replace ( "%s" , & i) )
67+ } )
5868}
5969
6070#[ cfg( feature = "serde" ) ]
You can’t perform that action at this time.
0 commit comments