pub struct ResolvedCrateConfig {Show 60 fields
pub name: String,
pub sources: Vec<PathBuf>,
pub source_crates: Vec<SourceCrate>,
pub version_from: String,
pub core_import: Option<String>,
pub workspace_root: Option<PathBuf>,
pub skip_core_import: bool,
pub error_type: Option<String>,
pub error_constructor: Option<String>,
pub features: Vec<String>,
pub path_mappings: HashMap<String, String>,
pub extra_dependencies: HashMap<String, Value>,
pub auto_path_mappings: bool,
pub languages: Vec<Language>,
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 dart: Option<DartConfig>,
pub kotlin: Option<KotlinConfig>,
pub kotlin_android: Option<KotlinAndroidConfig>,
pub jni: Option<JniConfig>,
pub swift: Option<SwiftConfig>,
pub gleam: Option<GleamConfig>,
pub csharp: Option<CSharpConfig>,
pub r: Option<RConfig>,
pub zig: Option<ZigConfig>,
pub exclude: ExcludeConfig,
pub include: IncludeConfig,
pub output_paths: HashMap<String, PathBuf>,
pub explicit_output: OutputConfig,
pub lint: HashMap<String, LintConfig>,
pub test: HashMap<String, TestConfig>,
pub setup: HashMap<String, SetupConfig>,
pub update: HashMap<String, UpdateConfig>,
pub clean: HashMap<String, CleanConfig>,
pub build_commands: HashMap<String, BuildCommandConfig>,
pub generate: GenerateConfig,
pub generate_overrides: HashMap<String, GenerateConfig>,
pub format: FormatConfig,
pub format_overrides: HashMap<String, FormatConfig>,
pub dto: DtoConfig,
pub tools: ToolsConfig,
pub opaque_types: HashMap<String, String>,
pub sync: Option<SyncConfig>,
pub citation: Option<CitationConfig>,
pub publish: Option<PublishConfig>,
pub e2e: Option<E2eConfig>,
pub adapters: Vec<AdapterConfig>,
pub trait_bridges: Vec<TraitBridgeConfig>,
pub scaffold: Option<ScaffoldConfig>,
pub readme: Option<ReadmeConfig>,
pub custom_files: HashMap<String, Vec<PathBuf>>,
pub custom_modules: CustomModulesConfig,
pub custom_registrations: CustomRegistrationsConfig,
}Expand description
Fully-resolved configuration for one crate.
Backends consume &ResolvedCrateConfig; they should not need to look at
the workspace defaults directly. Anything a backend reads has already been
merged in by crate::config::NewAlefConfig::resolve.
output_paths is precomputed: for every language this crate targets, the
map holds the resolved output directory (with {crate} and {lang}
placeholders substituted).
Fields§
§name: String§sources: Vec<PathBuf>§source_crates: Vec<SourceCrate>§version_from: String§core_import: Option<String>§workspace_root: Option<PathBuf>§skip_core_import: bool§error_type: Option<String>§error_constructor: Option<String>§features: Vec<String>§path_mappings: HashMap<String, String>§extra_dependencies: HashMap<String, Value>§auto_path_mappings: bool§languages: Vec<Language>§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>§dart: Option<DartConfig>§kotlin: Option<KotlinConfig>§kotlin_android: Option<KotlinAndroidConfig>§jni: Option<JniConfig>§swift: Option<SwiftConfig>§gleam: Option<GleamConfig>§csharp: Option<CSharpConfig>§r: Option<RConfig>§zig: Option<ZigConfig>§exclude: ExcludeConfig§include: IncludeConfig§output_paths: HashMap<String, PathBuf>Resolved output directory per language code ("python" → packages/python/spikard/).
Only contains entries for languages this crate actually targets.
explicit_output: OutputConfigRaw user-supplied per-language output paths from [crates.output].
Distinct from Self::output_paths: this preserves the original (possibly
None) value so methods that need to distinguish “user explicitly set this
path” from “template-derived” can do so. Used by Self::ffi_lib_name and
any other consumer that derives identifiers from the user-supplied path.
lint: HashMap<String, LintConfig>§test: HashMap<String, TestConfig>§setup: HashMap<String, SetupConfig>§update: HashMap<String, UpdateConfig>§clean: HashMap<String, CleanConfig>§build_commands: HashMap<String, BuildCommandConfig>§generate: GenerateConfig§generate_overrides: HashMap<String, GenerateConfig>§format: FormatConfig§format_overrides: HashMap<String, FormatConfig>§dto: DtoConfig§tools: ToolsConfig§opaque_types: HashMap<String, String>§sync: Option<SyncConfig>§citation: Option<CitationConfig>§publish: Option<PublishConfig>§e2e: Option<E2eConfig>§adapters: Vec<AdapterConfig>§trait_bridges: Vec<TraitBridgeConfig>§scaffold: Option<ScaffoldConfig>§readme: Option<ReadmeConfig>§custom_files: HashMap<String, Vec<PathBuf>>§custom_modules: CustomModulesConfig§custom_registrations: CustomRegistrationsConfigImplementations§
Source§impl ResolvedCrateConfig
impl ResolvedCrateConfig
Sourcepub fn jni_lib_name(&self) -> String
pub fn jni_lib_name(&self) -> String
Get the JNI native library name used by Android JNI Bridge objects.
Returns <ffi_prefix>_jni, parallel to Self::ffi_lib_name.
This is the library name passed to System.loadLibrary(...) in the
emitted Kotlin Bridge object when KotlinFfiStyle::Jni is active.
Sourcepub fn kotlin_ffi_style(&self) -> KotlinFfiStyle
pub fn kotlin_ffi_style(&self) -> KotlinFfiStyle
Returns the configured Kotlin FFI emission style.
Reads [crates.kotlin] ffi_style; defaults to KotlinFfiStyle::Panama.
The alef-backend-kotlin-android backend overrides this to Jni
unconditionally via Self::with_kotlin_ffi_style.
Sourcepub fn with_kotlin_ffi_style(self, style: KotlinFfiStyle) -> Self
pub fn with_kotlin_ffi_style(self, style: KotlinFfiStyle) -> Self
Return a clone of this config with the Kotlin FFI style forced to style.
Used by the Android backend so all downstream emitters see Jni mode
regardless of what the user wrote in [crates.kotlin] ffi_style.
Sourcepub fn ffi_prefix(&self) -> String
pub fn ffi_prefix(&self) -> String
Get the FFI prefix (e.g., "kreuzberg"). Used by FFI, Go, Java, C# backends.
Returns [ffi] prefix if set, otherwise derives from the crate name by
replacing hyphens with underscores.
Sourcepub fn ffi_lib_name(&self) -> String
pub fn ffi_lib_name(&self) -> String
Get the FFI native library name (for Go cgo, Java Panama, C# P/Invoke).
Resolution order:
[ffi] lib_nameexplicit override- Directory name of the user-supplied
[crates.output] ffipath with hyphens replaced by underscores (e.g.crates/html-to-markdown-ffi/src/→html_to_markdown_ffi). Walks components from the end and skipssrc/lib/includeto find the crate directory. {ffi_prefix}_ffifallback
Sourcepub fn ffi_header_name(&self) -> String
pub fn ffi_header_name(&self) -> String
Get the FFI header name.
Returns [ffi] header_name if set, otherwise "{ffi_prefix}.h".
Sourcepub fn ffi_plugin_error_constructor(&self) -> Option<String>
pub fn ffi_plugin_error_constructor(&self) -> Option<String>
Resolve the Rust expression used by FFI plugin shims
(plugin_impl_initialize, plugin_impl_shutdown) to construct an
error value from a runtime String named msg.
Returns [ffi] plugin_error_constructor verbatim when set; otherwise
None so callers can fall back to a generic constructor that doesn’t
depend on a specific error variant shape.
Sourcepub fn ffi_crate_path(&self) -> String
pub fn ffi_crate_path(&self) -> String
Get the relative path to the FFI crate from the e2e test directory.
Used by C e2e tests to locate the compiled FFI library when building against a local checkout rather than a downloaded release.
Resolution order:
- Directory name of the user-supplied
[crates.output] ffipath, skipping trailingsrc/lib/includecomponents, prefixed with../../so the path resolves frome2e/c/back to the repo root. E.g.crates/my-lib-ffi/src/→../../crates/my-lib-ffi. ../../crates/{name}-ffifallback derived from the crate name.
Sourcepub fn wasm_crate_path(&self) -> String
pub fn wasm_crate_path(&self) -> String
Get the relative path to the WASM crate’s pkg/ directory from the
e2e test directory.
Used by WASM e2e tests to import the wasm-pack build output when working against a local checkout rather than a published npm package.
Resolution order:
- Directory name of the user-supplied
[crates.output] wasmpath, skipping trailingsrc/lib/includecomponents, prefixed with../../and suffixed with/pkg. E.g.crates/my-lib-wasm/src/→../../crates/my-lib-wasm/pkg. ../../crates/{name}-wasm/pkgfallback derived from the crate name.
Source§impl ResolvedCrateConfig
impl ResolvedCrateConfig
Sourcepub fn resolve_field_name(
&self,
lang: Language,
type_name: &str,
field_name: &str,
) -> Option<String>
pub fn resolve_field_name( &self, lang: Language, type_name: &str, field_name: &str, ) -> Option<String>
Resolve the binding field name for a given language, type, and field.
Resolution order (highest to lowest priority):
- Per-language
rename_fieldsmap for the key"TypeName.field_name". - Automatic keyword escaping: if the field name is a reserved keyword in the target
language, append
_(e.g.class→class_). - Original field name unchanged.
Returns Some(escaped_name) when the field needs renaming, None when the original
name can be used as-is. Call sites that always need a String should use
resolve_field_name(...).unwrap_or_else(|| field_name.to_string()).
Sourcepub fn serde_rename_all_for_language(&self, lang: Language) -> String
pub fn serde_rename_all_for_language(&self, lang: Language) -> String
Get the effective serde rename_all strategy for a given language.
Resolution order:
- Per-language config override (
[python] serde_rename_all = "...") - Language default (idiomatic per-language JSON wire convention):
- camelCase: node, wasm, java, csharp, php, kotlin, swift, dart
- snake_case: python, ruby, go, ffi, elixir, r, rust, zig, c
Sourcepub fn rewrite_path(&self, rust_path: &str) -> String
pub fn rewrite_path(&self, rust_path: &str) -> String
Rewrite a Rust path using path_mappings.
Matches the longest prefix first so more-specific mappings take priority over broader ones.
Sourcepub fn bridge_associated_types(&self) -> HashSet<String>
pub fn bridge_associated_types(&self) -> HashSet<String>
Collect all associated type names declared across every configured trait bridge.
Returns the union of crate::config::TraitBridgeConfig::associated_type_names
for all bridges. Backends use this set to skip generic record/enum codegen for
these types, deferring to visitor-specific generators instead.
Sourcepub fn resolved_version(&self) -> Option<String>
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.
Checks [workspace.package] version first, then [package] version.
Source§impl ResolvedCrateConfig
impl ResolvedCrateConfig
Sourcepub fn try_github_repo(&self) -> Result<String, String>
pub fn try_github_repo(&self) -> Result<String, String>
Get the GitHub repository URL, returning an error when no source has it set.
Resolution order:
[e2e.registry] github_repo[scaffold] repository
Sourcepub fn github_repo(&self) -> String
pub fn github_repo(&self) -> String
Get the GitHub repository URL with a vendor-neutral placeholder fallback.
Sourcepub fn go_module(&self) -> String
pub fn go_module(&self) -> String
Get the Go module path with a vendor-neutral placeholder fallback.
Sourcepub fn java_package(&self) -> String
pub fn java_package(&self) -> String
Get the Java package name with a vendor-neutral placeholder fallback.
Sourcepub fn java_group_id(&self) -> String
pub fn java_group_id(&self) -> String
Get the Java Maven groupId.
Prefers the explicit [java] group_id override when set; otherwise falls back to
the Java package name (most projects publish under groupId == java package).
Sourcepub fn java_artifact_id(&self) -> String
pub fn java_artifact_id(&self) -> String
Get the Java Maven artifactId.
Prefers the explicit [java] artifact_id override; otherwise falls back to the
crate name ([[crates]] name).
Sourcepub fn kotlin_package(&self) -> String
pub fn kotlin_package(&self) -> String
Get the Kotlin package name with a vendor-neutral placeholder fallback.
Sourcepub fn csharp_namespace(&self) -> String
pub fn csharp_namespace(&self) -> String
Get the C# namespace.
Source§impl ResolvedCrateConfig
impl ResolvedCrateConfig
Sourcepub fn core_import_name(&self) -> String
pub fn core_import_name(&self) -> String
Get the core crate Rust import path (e.g., "liter_llm").
Returns [crate] core_import if set, otherwise derives it from the
crate name by replacing hyphens with underscores.
Sourcepub fn error_type_name(&self) -> String
pub fn error_type_name(&self) -> String
Get the crate error type name (e.g., "KreuzbergError").
Returns [crate] error_type if set, otherwise "Error".
Sourcepub fn error_constructor_expr(&self) -> String
pub fn error_constructor_expr(&self) -> String
Get the error constructor pattern. {msg} is replaced with the message expression.
Returns [crate] error_constructor if set, otherwise generates
"{core_import}::{error_type}::from({msg})".
Sourcepub fn core_crate_dir(&self) -> String
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.
Sourcepub fn core_crate_for_language(&self, lang: Language) -> String
pub fn core_crate_for_language(&self, lang: Language) -> String
Resolve the core Cargo dependency name (and matching directory) for a language’s binding crate.
Returns [<lang>].core_crate_override when set (currently honored for
wasm, dart, swift), otherwise falls back to Self::core_crate_dir.
Sourcepub fn core_import_for_language(&self, lang: Language) -> String
pub fn core_import_for_language(&self, lang: Language) -> String
Resolve the core crate Rust import path for a language’s binding crate.
When [<lang>].core_crate_override is set, the override name (with -
translated to _) is used so that generated use paths and From
impls reference the overridden crate. Otherwise falls back to
Self::core_import_name.
Sourcepub fn effective_path_mappings(&self) -> HashMap<String, String>
pub fn effective_path_mappings(&self) -> HashMap<String, String>
Return the effective path mappings for this crate.
When auto_path_mappings is true, automatically derives a mapping from each source
crate to the configured core_import facade. For each source file whose path contains
crates/{crate-name}/src/, a mapping {crate_name} → {core_import} is added
(hyphens in the crate name are converted to underscores). Source crates that already
equal core_import are skipped.
Explicit entries in path_mappings always override auto-derived ones.
Source§impl ResolvedCrateConfig
impl ResolvedCrateConfig
Sourcepub fn package_dir(&self, lang: Language) -> String
pub fn package_dir(&self, lang: Language) -> String
Get the package output directory for a language.
Uses scaffold_output from per-language config if set, otherwise defaults.
Sourcepub fn run_wrapper_for_language(&self, lang: Language) -> Option<&str>
pub fn run_wrapper_for_language(&self, lang: Language) -> Option<&str>
Get the run_wrapper for a language, if set.
Sourcepub fn extra_lint_paths_for_language(&self, lang: Language) -> &[String]
pub fn extra_lint_paths_for_language(&self, lang: Language) -> &[String]
Get the extra_lint_paths for a language.
Sourcepub fn project_file_for_language(&self, lang: Language) -> Option<&str>
pub fn project_file_for_language(&self, lang: Language) -> Option<&str>
Get the project_file for a language (Java or C# only).
Sourcepub fn lint_config_for_language(&self, lang: Language) -> LintConfig
pub fn lint_config_for_language(&self, lang: Language) -> LintConfig
Get the effective lint configuration for a language.
Sourcepub fn update_config_for_language(&self, lang: Language) -> UpdateConfig
pub fn update_config_for_language(&self, lang: Language) -> UpdateConfig
Get the effective update configuration for a language.
Sourcepub fn test_config_for_language(&self, lang: Language) -> TestConfig
pub fn test_config_for_language(&self, lang: Language) -> TestConfig
Get the effective test configuration for a language.
Sourcepub fn setup_config_for_language(&self, lang: Language) -> SetupConfig
pub fn setup_config_for_language(&self, lang: Language) -> SetupConfig
Get the effective setup configuration for a language.
Sourcepub fn clean_config_for_language(&self, lang: Language) -> CleanConfig
pub fn clean_config_for_language(&self, lang: Language) -> CleanConfig
Get the effective clean configuration for a language.
Sourcepub fn build_command_config_for_language(
&self,
lang: Language,
) -> BuildCommandConfig
pub fn build_command_config_for_language( &self, lang: Language, ) -> BuildCommandConfig
Get the effective build command configuration for a language.
Sourcepub fn features_for_language(&self, lang: Language) -> &[String]
pub fn features_for_language(&self, lang: Language) -> &[String]
Get the features to use for a specific language’s binding crate.
Source§impl ResolvedCrateConfig
impl ResolvedCrateConfig
Sourcepub fn python_module_name(&self) -> String
pub fn python_module_name(&self) -> String
Get the Python module name.
Sourcepub fn node_package_name(&self) -> String
pub fn node_package_name(&self) -> String
Get the Node package name.
Sourcepub fn ruby_gem_name(&self) -> String
pub fn ruby_gem_name(&self) -> String
Get the Ruby gem name.
Sourcepub fn php_extension_name(&self) -> String
pub fn php_extension_name(&self) -> String
Get the PHP extension name.
Sourcepub fn php_cargo_crate_name(&self) -> Option<&str>
pub fn php_cargo_crate_name(&self) -> Option<&str>
Get the PHP binding Cargo crate name (used for deriving the shared library filename).
Sourcepub fn elixir_app_name(&self) -> String
pub fn elixir_app_name(&self) -> String
Get the Elixir app name.
Sourcepub fn zig_module_name(&self) -> String
pub fn zig_module_name(&self) -> String
Get the Zig module name.
Sourcepub fn dart_pubspec_name(&self) -> String
pub fn dart_pubspec_name(&self) -> String
Get the Dart pubspec package name.
Returns [dart] pubspec_name if set, otherwise derives a snake_case
name from the crate name by replacing hyphens with underscores.
Sourcepub fn dart_bridge_class_name(&self) -> String
pub fn dart_bridge_class_name(&self) -> String
Get the Dart FRB bridge class name.
Converts [dart] lib_name (falling back to dart_pubspec_name()) to
PascalCase and appends "Bridge", matching the FRB v2 convention.
E.g. lib_name = "kreuzcrawl" → "KreuzcrawlBridge".
Sourcepub fn swift_module(&self) -> String
pub fn swift_module(&self) -> String
Get the Swift module name.
Returns [swift] module_name if configured, otherwise derives a PascalCase
name from the crate name (e.g. "my-lib" → "MyLib").
Sourcepub fn r_package_name(&self) -> String
pub fn r_package_name(&self) -> String
Get the R package name.
Sourcepub fn wasm_type_prefix(&self) -> String
pub fn wasm_type_prefix(&self) -> String
Get the WASM type name prefix (e.g. “Wasm” produces WasmConversionOptions).
Defaults to "Wasm".
Sourcepub fn node_type_prefix(&self) -> String
pub fn node_type_prefix(&self) -> String
Get the Node/NAPI type name prefix (e.g. “Js” produces JsConversionOptions).
Defaults to "Js".
Trait Implementations§
Source§impl Clone for ResolvedCrateConfig
impl Clone for ResolvedCrateConfig
Source§fn clone(&self) -> ResolvedCrateConfig
fn clone(&self) -> ResolvedCrateConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more