alef_core/config/
extras.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash)]
4#[serde(rename_all = "lowercase")]
5pub enum Language {
6 Python,
7 Node,
8 Ruby,
9 Php,
10 Elixir,
11 Wasm,
12 Ffi,
13 Go,
14 Java,
15 Csharp,
16 R,
17 Rust,
18}
19
20impl std::fmt::Display for Language {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 match self {
23 Self::Python => write!(f, "python"),
24 Self::Node => write!(f, "node"),
25 Self::Ruby => write!(f, "ruby"),
26 Self::Php => write!(f, "php"),
27 Self::Elixir => write!(f, "elixir"),
28 Self::Wasm => write!(f, "wasm"),
29 Self::Ffi => write!(f, "ffi"),
30 Self::Go => write!(f, "go"),
31 Self::Java => write!(f, "java"),
32 Self::Csharp => write!(f, "csharp"),
33 Self::R => write!(f, "r"),
34 Self::Rust => write!(f, "rust"),
35 }
36 }
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41pub struct AdapterParam {
42 pub name: String,
43 #[serde(rename = "type")]
44 pub ty: String,
45 #[serde(default)]
46 pub optional: bool,
47}
48
49#[derive(Debug, Clone, Serialize, Deserialize)]
51#[serde(rename_all = "snake_case")]
52pub enum AdapterPattern {
53 SyncFunction,
54 AsyncMethod,
55 CallbackBridge,
56 Streaming,
57 ServerLifecycle,
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62pub struct AdapterConfig {
63 pub name: String,
64 pub pattern: AdapterPattern,
65 pub core_path: String,
67 #[serde(default)]
69 pub params: Vec<AdapterParam>,
70 pub returns: Option<String>,
72 pub error_type: Option<String>,
74 pub owner_type: Option<String>,
76 pub item_type: Option<String>,
78 #[serde(default)]
80 pub gil_release: bool,
81 #[serde(default)]
83 pub trait_name: Option<String>,
84 #[serde(default)]
86 pub trait_method: Option<String>,
87 #[serde(default)]
89 pub detect_async: bool,
90}