File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 1
- use proc_macro2:: { Ident , TokenStream } ;
1
+ use proc_macro2:: { Ident , TokenStream , Span } ;
2
2
use quote:: { quote, ToTokens } ;
3
3
4
4
#[ derive( Clone , Debug ) ]
@@ -138,12 +138,19 @@ pub struct ArrayAccessor {
138
138
impl ToTokens for ArrayAccessor {
139
139
fn to_tokens ( & self , tokens : & mut TokenStream ) {
140
140
let Self { doc, name, ty, .. } = self ;
141
+ let name_iter = Ident :: new ( & format ! ( "{name}_iter" ) , Span :: call_site ( ) ) ;
141
142
quote ! {
142
143
#[ doc = #doc]
143
144
#[ inline( always) ]
144
145
pub const fn #name( & self , n: usize ) -> & #ty {
145
146
& self . #name[ n]
146
147
}
148
+ #[ doc = "Iterator for array of:" ]
149
+ #[ doc = #doc]
150
+ #[ inline( always) ]
151
+ pub fn #name_iter( & self ) -> impl Iterator <Item =& #ty> {
152
+ self . #name. iter( )
153
+ }
147
154
}
148
155
. to_tokens ( tokens) ;
149
156
}
You can’t perform that action at this time.
0 commit comments