debian/missing-sources/derive_more-impl/src/as/ref.rs
raw| 1 | //! Implementation of an [`AsRef`] derive macro. |
| 2 | |
| 3 | use proc_macro2::TokenStream; |
| 4 | use quote::format_ident; |
| 5 | |
| 6 | /// Expands an [`AsRef`] derive macro. |
| 7 | pub(crate) fn expand( |
| 8 | input: &syn::DeriveInput, |
| 9 | trait_name: &'static str, |
| 10 | ) -> syn::Result<TokenStream> { |
| 11 | let trait_ident = format_ident!("{trait_name}"); |
| 12 | let method_ident = format_ident!("as_ref"); |
| 13 | |
| 14 | super::expand(input, (&trait_ident, &method_ident, None)) |
| 15 | } |