1use serde::Deserialize;
4use std::collections::HashMap;
5
6#[derive(Deserialize)]
8pub struct UikaConfig {
9 pub codegen: CodegenConfig,
10 #[serde(default)]
11 pub ue: Option<UeConfig>,
12 #[serde(default)]
13 pub build: Option<BuildConfig>,
14 #[serde(default)]
15 pub project: Option<ProjectConfig>,
16}
17
18#[derive(Deserialize)]
19pub struct UeConfig {
20 pub engine_path: String,
21}
22
23#[derive(Deserialize)]
24pub struct BuildConfig {
25 pub crate_name: Option<String>,
27}
28
29#[derive(Deserialize)]
30pub struct ProjectConfig {
31 #[serde(default = "default_project_path")]
34 pub path: String,
35}
36
37fn default_project_path() -> String {
38 ".".to_string()
39}
40
41#[derive(Deserialize)]
42pub struct CodegenConfig {
43 pub features: Vec<String>,
44 pub paths: CodegenPaths,
45 pub modules: HashMap<String, ModuleMapping>,
46 pub blocklist: Blocklist,
47}
48
49#[derive(Deserialize)]
50pub struct CodegenPaths {
51 pub uht_input: String,
52 pub rust_out: String,
53 pub cpp_out: String,
54}
55
56#[derive(Deserialize)]
57pub struct ModuleMapping {
58 pub module: String,
59 pub feature: String,
60}
61
62#[derive(Deserialize)]
63pub struct Blocklist {
64 pub classes: Vec<String>,
65 pub structs: Vec<String>,
66 pub functions: Vec<String>,
68}
69
70impl Blocklist {
71 pub fn function_tuples(&self) -> Vec<(String, String)> {
73 self.functions
74 .iter()
75 .filter_map(|entry| {
76 let (class, func) = entry.split_once('.')?;
77 Some((class.to_string(), func.to_string()))
78 })
79 .collect()
80 }
81}