Skip to main content

ib_shell/hook/
mod.rs

1use bon::Builder;
2use serde::{Deserialize, Serialize};
3
4pub mod dll;
5pub mod inject;
6
7/**
8<div class="warning">
9
10The injector and the DLL MUST use the same crate features.
11Otherwise, deserialization may result in corrupted config or fail.
12</div>
13*/
14#[derive(Default, Serialize, Deserialize, Clone, Builder, Debug)]
15pub struct HookConfig {
16    #[cfg(feature = "item")]
17    item: crate::item::hook::HookConfig,
18}
19
20/// Set the hook with optional config.
21/// If config is None, the hook is disabled.
22pub fn set_hook(config: Option<HookConfig>) {
23    #[cfg(feature = "item")]
24    crate::item::hook::set_hook(config.map(|c| c.item));
25}