Crates.io | proc-macro-type-name |
lib.rs | proc-macro-type-name |
version | 0.1.0 |
source | src |
created_at | 2023-02-27 11:38:23.666076 |
updated_at | 2023-02-27 11:38:23.666076 |
description | Convert Rust field names (snake case) to type names (pascal case) using proc_macro2 identifiers.. |
homepage | |
repository | https://github.com/lpotthast/proc-macro-type-name |
max_upload_size | |
id | 795872 |
size | 16,497 |
Convert Rust field names (snake case) to type names (pascal case) using proc_macro2 identifiers.
use proc_macro_type_name::ToTypeName;
let ident: proc_macro2::Indent = Ident::new("foo_bar", Span::call_site());
let type_ident = (&ident).to_type_ident(ident.span());
assert_eq!(type_ident.to_string(), "FooBar".to_owned());
quote! {
enum #type_ident {}
}