hirust-macros 0.1.15

A Rust Macros
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use proc_macro::{TokenStream, TokenTree};

pub(crate) fn tag_impl(args: TokenStream, input: TokenStream) -> TokenStream {
    let mut is_name = false;
    let mut _name = String::new();
    for arg in args.into_iter() {
        if matches!(&arg, TokenTree::Ident(_)) && "path".eq(&arg.to_string()) {
            is_name = true;
        }
        if is_name && matches!(&arg, TokenTree::Literal(_)) {
            let temp = arg.to_string();
            _name = temp.clone().replace("\"", "");
            is_name = false;
        }
    }
    input
}