From b2c6467a54874d78df601535b337b1029b8b75bd Mon Sep 17 00:00:00 2001 From: notnotmelon Date: Mon, 12 Aug 2024 14:38:45 -0500 Subject: [PATCH] refactor: Rename rivets:initalize!() to rivets:finalize!() --- rivets-macros/src/lib.rs | 8 ++++---- rivets-shared/src/lib.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rivets-macros/src/lib.rs b/rivets-macros/src/lib.rs index 6432f44..149f34d 100644 --- a/rivets-macros/src/lib.rs +++ b/rivets-macros/src/lib.rs @@ -163,11 +163,11 @@ pub fn detour(attr: TokenStream, item: TokenStream) -> TokenStream { result.into() } -/// A procedural macro for initializing the rivets library. +/// A procedural macro for finalizing the rivets library. /// This macro should be called once at the end of the `main.rs` file. -/// It will initialize the rivets library and inject all of the detours. +/// It will finalize the rivets library and inject all of the detours. #[proc_macro] -pub fn initialize(_: TokenStream) -> TokenStream { +pub fn finalize(_: TokenStream) -> TokenStream { let injects = unsafe { MANGLED_NAMES.clone() }; let injects = injects.iter().map(|(mangled_name, name)| { let name = Ident::new(name, proc_macro2::Span::call_site()); @@ -185,7 +185,7 @@ pub fn initialize(_: TokenStream) -> TokenStream { quote! { #[rivets::abi_stable::sabi_extern_fn] - pub extern "C" fn rivets_initialize() -> #vec { + pub extern "C" fn rivets_finalize() -> #vec { let mut hooks: #vec = #vec::new(); #(#injects)* hooks diff --git a/rivets-shared/src/lib.rs b/rivets-shared/src/lib.rs index e35ea88..9ea33cd 100644 --- a/rivets-shared/src/lib.rs +++ b/rivets-shared/src/lib.rs @@ -52,6 +52,6 @@ pub struct RivetsHook { #[repr(C)] #[derive(StableAbi)] -pub struct RivetsInitializeABI { +pub struct RivetsFinalizeABI { pub get_hooks: extern "C" fn() -> RVec, }