1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use crate::{logging::BoxDynLogTarget, PluginDefinition};
use abi_stable::{declare_root_module_statics, package_version_strings};
use abi_stable::{library::RootModule, sabi_types::VersionStrings, std_types::RVec, StableAbi};

/// [`RootModule`] for a plugin. It is auto-implemented using the macros.
#[repr(C)]
#[derive(StableAbi)]
#[sabi(kind(Prefix(prefix_ref = PluginLibRef)))]
pub struct PluginLib {
	#[sabi(last_prefix_field)]
	pub plugin: extern "C" fn(log_target: BoxDynLogTarget) -> RVec<PluginDefinition>,
}

#[allow(clippy::use_self)]
impl RootModule for PluginLibRef {
	declare_root_module_statics! {PluginLibRef}

	const BASE_NAME: &'static str = "gravel_ffi";
	const NAME: &'static str = "gravel_ffi";
	const VERSION_STRINGS: VersionStrings = package_version_strings!();
}