Skip to main content

AlefConfig

Struct AlefConfig 

Source
pub struct AlefConfig {
Show 30 fields pub crate_config: CrateConfig, pub languages: Vec<Language>, pub exclude: ExcludeConfig, pub include: IncludeConfig, pub output: OutputConfig, pub python: Option<PythonConfig>, pub node: Option<NodeConfig>, pub ruby: Option<RubyConfig>, pub php: Option<PhpConfig>, pub elixir: Option<ElixirConfig>, pub wasm: Option<WasmConfig>, pub ffi: Option<FfiConfig>, pub go: Option<GoConfig>, pub java: Option<JavaConfig>, pub csharp: Option<CSharpConfig>, pub r: Option<RConfig>, pub scaffold: Option<ScaffoldConfig>, pub readme: Option<ReadmeConfig>, pub lint: Option<HashMap<String, LintConfig>>, pub test: Option<HashMap<String, TestConfig>>, pub custom_files: Option<HashMap<String, Vec<PathBuf>>>, pub adapters: Vec<AdapterConfig>, pub custom_modules: CustomModulesConfig, pub custom_registrations: CustomRegistrationsConfig, pub sync: Option<SyncConfig>, pub opaque_types: HashMap<String, String>, pub generate: GenerateConfig, pub generate_overrides: HashMap<String, GenerateConfig>, pub dto: DtoConfig, pub e2e: Option<E2eConfig>,
}
Expand description

Root configuration from alef.toml.

Fields§

§crate_config: CrateConfig§languages: Vec<Language>§exclude: ExcludeConfig§include: IncludeConfig§output: OutputConfig§python: Option<PythonConfig>§node: Option<NodeConfig>§ruby: Option<RubyConfig>§php: Option<PhpConfig>§elixir: Option<ElixirConfig>§wasm: Option<WasmConfig>§ffi: Option<FfiConfig>§go: Option<GoConfig>§java: Option<JavaConfig>§csharp: Option<CSharpConfig>§r: Option<RConfig>§scaffold: Option<ScaffoldConfig>§readme: Option<ReadmeConfig>§lint: Option<HashMap<String, LintConfig>>§test: Option<HashMap<String, TestConfig>>§custom_files: Option<HashMap<String, Vec<PathBuf>>>§adapters: Vec<AdapterConfig>§custom_modules: CustomModulesConfig§custom_registrations: CustomRegistrationsConfig§sync: Option<SyncConfig>§opaque_types: HashMap<String, String>

Declare opaque types from external crates that alef can’t extract. Map of type name → Rust path (e.g., “Tree” = “tree_sitter_language_pack::Tree”). These get opaque wrapper structs in all backends.

§generate: GenerateConfig

Controls which generation passes alef runs (all default to true).

§generate_overrides: HashMap<String, GenerateConfig>

Per-language overrides for generate flags (key = language name, e.g., “python”).

§dto: DtoConfig

Per-language DTO/type generation style (dataclass vs TypedDict, zod vs interface, etc.).

§e2e: Option<E2eConfig>

E2E test generation configuration.

Implementations§

Source§

impl AlefConfig

Source

pub fn features_for_language(&self, lang: Language) -> &[String]

Get the features to use for a specific language’s binding crate. Checks for a per-language override first, then falls back to [crate] features.

Source

pub fn core_import(&self) -> String

Get the core crate import path (e.g., “liter_llm”). Used by codegen to call into the core crate.

Source

pub fn ffi_prefix(&self) -> String

Get the FFI prefix (e.g., “kreuzberg”). Used by FFI, Go, Java, C# backends.

Source

pub fn ffi_lib_name(&self) -> String

Get the FFI native library name (for Go cgo, Java Panama, C# P/Invoke).

Resolution order:

  1. [ffi] lib_name explicit override
  2. Directory name of output.ffi path with hyphens replaced by underscores (e.g. crates/html-to-markdown-ffi/src/html_to_markdown_ffi)
  3. {ffi_prefix}_ffi fallback
Source

pub fn ffi_header_name(&self) -> String

Get the FFI header name.

Source

pub fn python_module_name(&self) -> String

Get the Python module name.

Source

pub fn node_package_name(&self) -> String

Get the Node package name.

Source

pub fn ruby_gem_name(&self) -> String

Get the Ruby gem name.

Source

pub fn php_extension_name(&self) -> String

Get the PHP extension name.

Source

pub fn elixir_app_name(&self) -> String

Get the Elixir app name.

Source

pub fn go_module(&self) -> String

Get the Go module path.

Source

pub fn java_package(&self) -> String

Get the Java package name.

Source

pub fn java_group_id(&self) -> String

Get the Java Maven groupId.

Uses the full Java package as the groupId, matching Maven convention where groupId equals the package declaration.

Source

pub fn csharp_namespace(&self) -> String

Get the C# namespace.

Source

pub fn core_crate_dir(&self) -> String

Get the directory name of the core crate (derived from sources or falling back to name).

For example, if sources contains "crates/html-to-markdown/src/lib.rs", this returns "html-to-markdown". Used by the scaffold to generate correct path = "../../crates/…" references in binding-crate Cargo.toml files.

Source

pub fn r_package_name(&self) -> String

Get the R package name.

Source

pub fn resolved_version(&self) -> Option<String>

Attempt to read the resolved version string from the configured version_from file. Returns None if the file cannot be read or the version cannot be found.

Source

pub fn serde_rename_all_for_language(&self, lang: Language) -> String

Get the effective serde rename_all strategy for a given language.

Resolution order:

  1. Per-language config override ([python] serde_rename_all = "...")
  2. Language default:
    • camelCase: node, wasm, java, csharp
    • snake_case: python, ruby, php, go, ffi, elixir, r
Source

pub fn rewrite_path(&self, rust_path: &str) -> String

Rewrite a rust_path using path_mappings. Matches the longest prefix first.

Trait Implementations§

Source§

impl Clone for AlefConfig

Source§

fn clone(&self) -> AlefConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AlefConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AlefConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for AlefConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,