extern crate proc_macro; // Cargo.toml ã¸ã®è¿½è¨ã¯å¿ è¦ãªã use proc_macro::TokenStream; #[proc_macro_derive(Hoge)] pub fn derive_hoge(input: TokenStream) -> TokenStream { // ããã«å®ä½ãè¨è¿°ããï¼ } TokenStream ã®å®ä½ã¯ libsyntax å ã§å®ç¾©ããã¦ãã syntax::tokenstream::TokenStream ãã©ãããããã®ã§ãã 1 ï¼æä¾ããã¦ããã¡ã½ãããæååã¸ã®å¤æç¨åº¦ãããªã解æçµæãç´æ¥ç¨ãããã¨ãåºæ¥ãªãããã«ãªã£ã¦ãã¾ã 2ï¼ãã®ããç¾ç¶ã§ã¯ TokenStream ãä¸æ¦æååã«å¤æãã¦æ§æ解æãç´ããã¨ãå¿ è¦ã§ãï¼ãã®éã«å¿ è¦ã¨ãªã Rust ã³ã¼ãã®æ§æ解æå¨ã¯ syn ã¨ãã cr
{{#tags}}- {{label}}
{{/tags}}