pub struct ResolvedCrateConfig {Show 57 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 gleam: Option<GleamConfig>,
pub go: Option<GoConfig>,
pub java: Option<JavaConfig>,
pub dart: Option<DartConfig>,
pub kotlin: Option<KotlinConfig>,
pub swift: Option<SwiftConfig>,
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 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>§gleam: Option<GleamConfig>§go: Option<GoConfig>§java: Option<JavaConfig>§dart: Option<DartConfig>§kotlin: Option<KotlinConfig>§swift: Option<SwiftConfig>§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>§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 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".
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:
- camelCase: node, wasm, java, csharp
- snake_case: all others
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 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.
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 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