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

ambee/giterated

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

Huge refactor to prep for moving the daemon over to the plugin architecture

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨5df753c

⁨giterated-plugins/giterated-plugin/src/vtable/host.rs⁩ - ⁨1719⁩ bytes
Raw
1 use super::{ObjectVtable, OperationVTable, SettingVtable, ValueVTable};
2 use crate::{
3 callback::{OperationHandlerCallback, SettingGetterCallback, ValueGetterCallback},
4 handle::PluginInitializationState,
5 };
6 use std::fmt::Debug;
7
8 #[repr(C)]
9 pub struct HostVTable {}
10
11 #[repr(C)]
12 #[derive(Clone, Copy)]
13 pub struct InitializationVTable {
14 pub register_object:
15 unsafe extern "C" fn(*mut PluginInitializationState, &'static str, ObjectVtable),
16 pub register_operation: unsafe extern "C" fn(
17 *mut PluginInitializationState,
18 &'static str,
19 &'static str,
20 OperationVTable,
21 ),
22 pub register_setting: unsafe extern "C" fn(
23 *mut PluginInitializationState,
24 &'static str,
25 &'static str,
26 SettingVtable,
27 ),
28 pub register_value: unsafe extern "C" fn(
29 *mut PluginInitializationState,
30 &'static str,
31 &'static str,
32 ValueVTable,
33 ),
34
35 pub operation_handler: unsafe extern "C" fn(
36 *mut PluginInitializationState,
37 &'static str,
38 &'static str,
39 OperationHandlerCallback,
40 ),
41
42 pub value_getter: unsafe extern "C" fn(
43 *mut PluginInitializationState,
44 &'static str,
45 &'static str,
46 ValueGetterCallback,
47 ),
48
49 pub setting_getter: unsafe extern "C" fn(
50 *mut PluginInitializationState,
51 &'static str,
52 &'static str,
53 SettingGetterCallback,
54 ),
55 }
56
57 impl Debug for InitializationVTable {
58 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
59 f.debug_struct("InitializationVTable").finish()
60 }
61 }
62
63 unsafe impl Sync for InitializationVTable {}
64 unsafe impl Send for InitializationVTable {}
65