telety_impl/alias/
index.rs1use quote::format_ident;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5pub(crate) enum Index {
6 Primary,
8 Secondary(usize),
10}
11
12impl Index {
13 pub(crate) fn ident(self, friendly_ident: &syn::Ident) -> syn::Ident {
14 format_ident!("{}__{friendly_ident}", self.ident_core())
15 }
16
17 pub(crate) fn ident_internal(self, friendly_ident: &syn::Ident) -> syn::Ident {
18 format_ident!("{}Internal__{friendly_ident}", self.ident_core())
19 }
20
21 pub(crate) fn ident_core(self) -> syn::Ident {
22 match self {
23 Self::Primary => format_ident!("AliasSelf"),
24 Self::Secondary(index) => format_ident!("Alias{index}"),
25 }
26 }
27}