1 2 3 4 5 6 7 8 9 10 11
extern crate proc_macro; use isahc::prelude::*; use proc_macro::TokenStream; #[proc_macro] pub fn include_raw_url(item: TokenStream) -> TokenStream { let mut url = item.to_string().get(1..).unwrap().to_string(); url.pop(); // remove first and last char (") from arg isahc::get(url).unwrap().text().unwrap().parse().unwrap() }