use proc_macro::TokenStream; use quote::quote; use syn::{parse_macro_input, Abi, Attribute, ItemFn}; extern crate proc_macro; #[proc_macro] pub fn plugin(metadata: TokenStream) -> TokenStream { emit_plugin_api().into() } #[proc_macro_attribute] pub fn plugin_init(attribute: TokenStream, item: TokenStream) -> TokenStream { let mut input = parse_macro_input!(item as ItemFn); quote! { #[doc(hidden)] #[no_mangle] unsafe extern "C" fn __plugin_init() { #input.sig.ident() } } .into() } fn emit_plugin_api() -> impl Into { quote! { #[doc(hidden)] #[no_mangle] unsafe extern "C" fn __load_runtime_vtable(vtable: &'static ::giterated_abi::VTable) { todo!() } #[doc(hidden)] #[no_mangle] unsafe extern "C" fn __get_plugin_vtable() -> &'static ::giterated_abi::VTable { todo!() } } }