zyn_core/ident.rs
1use proc_macro2::Ident;
2use proc_macro2::Span;
3
4/// An iterator that yields unique internal identifiers for template expansion.
5pub struct Iter {
6 counter: usize,
7}
8
9impl Iter {
10 pub fn new() -> Self {
11 Self { counter: 0 }
12 }
13}
14
15impl Default for Iter {
16 fn default() -> Self {
17 Self::new()
18 }
19}
20
21impl Iterator for Iter {
22 type Item = Ident;
23
24 fn next(&mut self) -> Option<Self::Item> {
25 let id = Ident::new(&format!("__zyn_ts_{}", self.counter), Span::call_site());
26
27 self.counter += 1;
28 Some(id)
29 }
30}