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/).
9
9
10
10
- Bump MSRV to 1.58.0
11
11
12
+ - ` array::names ` returns custom names if specified
13
+
12
14
## [ v0.14.2] - 2023-04-04
13
15
14
16
- Add support of ` a-Z ` for ` dimIndex `
Original file line number Diff line number Diff line change 53
53
/// Return list of names of instances in array
54
54
pub fn names < ' a , T : Name > ( info : & ' a T , dim : & ' a DimElement ) -> impl Iterator < Item = String > + ' a {
55
55
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
+ } )
58
68
}
59
69
60
70
#[ cfg( feature = "serde" ) ]
You can’t perform that action at this time.
0 commit comments