JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Before

Amber - ⁨1⁩ year ago

parent: tbd commit: ⁨e432306

⁨giterated-plugin/src/lib.rs⁩ - ⁨1127⁩ bytes
Raw
1 #![allow(improper_ctypes_definitions)]
2
3 pub mod callback;
4 pub mod future;
5 pub mod handle;
6 pub mod new_stack;
7 pub mod state;
8 pub mod vtable;
9
10 #[macro_use]
11 extern crate tracing;
12
13 use std::{marker::PhantomData, mem::forget};
14
15 use callback::RuntimeState;
16 use dlopen2::wrapper::WrapperApi;
17
18 use giterated_abi::vtable::VTable;
19 use handle::PluginInitializationState;
20 use new_stack::{FFIPluginMeta, PluginState};
21
22 use vtable::{HostVTable, Initialization};
23
24 #[derive(WrapperApi)]
25 pub struct GiteratedPluginApi {
26 plugin_meta: unsafe extern "C" fn() -> FFIPluginMeta,
27 load_host_vtable: unsafe extern "C" fn(vtable: &HostVTable),
28 load_initialization_vtable: unsafe extern "C" fn(vtable: &'static VTable<Initialization>),
29 initialize: unsafe extern "C" fn(runtime_state: *const RuntimeState) -> PluginState,
30 initialize_registration: unsafe extern "C" fn(
31 init_state: *mut PluginInitializationState,
32 ) -> *mut PluginInitializationState,
33 load_type_metadata: unsafe extern "C" fn(metadata: *mut ()),
34 }
35
36 pub mod plugin {
37 pub use giterated_macros::plugin_init as init;
38 }
39
40 pub use giterated_macros::plugin;
41