prefixes_p/lib.rs
1//! A procedural macro that allows you to use the `p` attribute to create a `Path` 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]
9pub fn p(_: TokenStream, input: TokenStream) -> TokenStream {
10 let input = parse_macro_input!(input as LitStr);
11
12 quote! { ::std::path::Path::new(#input) }.into()
13}