gravel_ffi/
lib.rs

1//! This is the interface library between the main gravel application and individual plugins.
2//!
3//! [`abi_stable`] is used to facilitate safe FFI across compiler versions.
4
5// the abi_stable derives/macros generate code that doesn't gel with these lints
6// since you can't just slap these on generated code they're disabled for the whole crate
7#![expect(
8	clippy::used_underscore_binding,
9	non_local_definitions,
10	single_use_lifetimes,
11	unused_qualifications
12)]
13
14mod cache;
15#[doc(hidden)]
16pub mod config;
17mod frontend;
18mod hit;
19pub mod logging;
20pub mod paths;
21mod plugin;
22mod prefix;
23mod provider;
24
25/// This module re-exports the types needed to write plugins.
26///
27/// Bring them all into scope with `use gravel_ffi::prelude::*;`.  
28/// <sub>may not actually contain *all* types required; terms and conditions apply</sub>
29pub mod prelude {
30	pub use crate::{
31		ActionKind, ArcDynHit, BoxDynFrontendContext, Frontend, FrontendContext, FrontendContextExt,
32		FrontendExitStatus, FrontendMessage, FrontendMessageNe, Hit, HitCache, MAX_SCORE, MIN_SCORE,
33		PluginConfigAdapter, Provider, ProviderResult, QueryResult, RefDynHitActionContext, ScoredHit, SimpleHit,
34		StaticHitCache, gravel_frontend, gravel_provider,
35	};
36
37	pub use abi_stable::external_types::crossbeam_channel::RReceiver;
38	pub use abi_stable::std_types::{ROption, RStr};
39	pub use abi_stable::traits::{IntoReprC, IntoReprRust};
40}
41
42pub use cache::{HitCache, StaticHitCache};
43pub use config::PluginConfigAdapter;
44pub use frontend::{
45	BoxDynFrontend, BoxDynFrontendContext, Frontend, FrontendContext, FrontendContextExt, FrontendExitStatus,
46	FrontendExitStatusNe, FrontendInner, FrontendMessage, FrontendMessageNe, QueryResult,
47};
48pub use hit::{
49	ActionKind, ArcDynHit, Hit, HitActionContext, MAX_SCORE, MIN_SCORE, RefDynHitActionContext, ScoredHit, SimpleHit,
50	clone_hit_arc,
51};
52pub use plugin::{PluginDefinition, PluginMetadata};
53pub use prefix::{PluginLib, PluginLibRef};
54pub use provider::{BoxDynProvider, Provider, ProviderInner, ProviderResult};
55
56pub use gravel_ffi_macros::*;
57
58#[cfg(test)]
59mod clippy_shut_up {
60	// this has to be put *somewhere* so clippy doesn't complain that the crate is unused
61	// (even though it's used in the integration tests)
62	use gravel_core as _;
63	use gravel_test_utils as _;
64}