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 } ;
22use quote:: { quote, ToTokens } ;
33
44#[ derive( Clone , Debug ) ]
@@ -138,12 +138,19 @@ pub struct ArrayAccessor {
138138impl ToTokens for ArrayAccessor {
139139 fn to_tokens ( & self , tokens : & mut TokenStream ) {
140140 let Self { doc, name, ty, .. } = self ;
141+ let name_iter = Ident :: new ( & format ! ( "{name}_iter" ) , Span :: call_site ( ) ) ;
141142 quote ! {
142143 #[ doc = #doc]
143144 #[ inline( always) ]
144145 pub const fn #name( & self , n: usize ) -> & #ty {
145146 & self . #name[ n]
146147 }
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+ }
147154 }
148155 . to_tokens ( tokens) ;
149156 }
You can’t perform that action at this time.
0 commit comments