Skip to main content

Module conversions

Module conversions 

Source

Structs§

ConversionConfig
Backend-specific configuration for From/field conversion generation. Enables shared code to handle all backend differences via parameters.

Functions§

binding_to_core_match_arm
Generate a match arm for binding -> core direction. Binding enums are always unit-variant-only. Core enums may have data variants. For data variants: BindingEnum::Variant => CoreEnum::Variant(Default::default(), ...)
can_generate_conversion
Check if a specific type is in the convertible set.
can_generate_enum_conversion
Check if an enum can have From/Into safely generated (both directions). All enums are allowed — data variants use Default::default() for non-simple fields in the binding→core direction.
can_generate_enum_conversion_from_core
Check if an enum can have core→binding From safely generated. This is always possible: unit variants map 1:1, data variants discard data with ...
convertible_types
Build the set of types that can have binding→core From safely generated. Strict: excludes types with sanitized fields (lossy conversion). This is transitive: a type is convertible only if all its Named field types are also convertible (or are enums with From/Into support).
core_enum_path
Derive the Rust import path for an enum, replacing hyphens with underscores.
core_to_binding_convertible_types
Build the set of types that can have core→binding From safely generated. More permissive than binding→core: allows sanitized fields (uses format!(“{:?}”)) and accepts data enums (data discarded with .. in match arms).
core_to_binding_match_arm
Generate a match arm for core -> binding direction. When the binding also has data variants, destructure and forward fields. When the binding is unit-variant-only, discard core data with ...
core_type_path
Derive the Rust import path from rust_path, replacing hyphens with underscores.
field_conversion_from_core
Same but for core -> binding direction. Some types are asymmetric (PathBuf→String, sanitized fields need .to_string()).
field_conversion_from_core_cfg
Core→binding field conversion with backend-specific config.
field_conversion_to_core
Determine the field conversion expression for binding -> core.
field_conversion_to_core_cfg
Binding→core field conversion with backend-specific config (i64 casts, etc.).
gen_enum_from_binding_to_core
Generate impl From<BindingEnum> for core::Enum (binding -> core).
gen_enum_from_binding_to_core_cfg
Generate impl From<BindingEnum> for core::Enum with backend-specific config.
gen_enum_from_core_to_binding
Generate impl From<core::Enum> for BindingEnum (core -> binding).
gen_enum_from_core_to_binding_cfg
Generate impl From<core::Enum> for BindingEnum with backend-specific config.
gen_from_binding_to_core
Generate impl From<BindingType> for core::Type (binding -> core). Sanitized fields use Default::default() (lossy but functional).
gen_from_binding_to_core_cfg
Generate impl From<BindingType> for core::Type with backend-specific config.
gen_from_core_to_binding
Generate impl From<core::Type> for BindingType (core -> binding).
gen_from_core_to_binding_cfg
Generate impl From<core::Type> for BindingType with backend-specific config.
has_sanitized_fields
Check if a type has any sanitized fields (binding→core conversion is lossy).
is_tuple_variant
Returns true if fields represent a tuple variant (positional: _0, _1, …).