prefixes_uppercase_p/
lib.rs

1//! A procedural macro that allows you to use the `P` attribute to create a `PathBuf` from a string literal.
2//! Part of the [prefixes](https://crates.io/crates/prefixes) crate.
3
4use proc_macro::TokenStream;
5use quote::quote;
6use syn::{parse_macro_input, LitStr};
7
8#[proc_macro_attribute]
9#[allow(non_snake_case)]
10pub fn P(_: TokenStream, input: TokenStream) -> TokenStream {
11    let input = parse_macro_input!(input as LitStr);
12
13    quote! { ::std::path::PathBuf::from(format!(#input)) }.into()
14}