pub struct CodegenContext {
pub classes: HashMap<String, ClassInfo>,
pub structs: HashMap<String, StructInfo>,
pub enums: HashMap<String, EnumInfo>,
pub package_to_module: HashMap<String, String>,
pub module_to_feature: HashMap<String, String>,
pub enabled_modules: HashSet<String>,
pub module_classes: BTreeMap<String, Vec<ClassInfo>>,
pub module_structs: BTreeMap<String, Vec<StructInfo>>,
pub module_enums: BTreeMap<String, Vec<EnumInfo>>,
pub func_table: Vec<FuncEntry>,
pub module_deps: BTreeMap<String, BTreeSet<String>>,
}Expand description
Central build context for the codegen pipeline.
Fields§
§classes: HashMap<String, ClassInfo>All classes by name.
structs: HashMap<String, StructInfo>All structs by name.
enums: HashMap<String, EnumInfo>All enums by name.
package_to_module: HashMap<String, String>Package name → Rust module name.
module_to_feature: HashMap<String, String>Rust module name → Cargo feature name.
enabled_modules: HashSet<String>Set of enabled Rust module names (derived from features).
module_classes: BTreeMap<String, Vec<ClassInfo>>Classes grouped by module name. Sorted for determinism.
module_structs: BTreeMap<String, Vec<StructInfo>>Structs grouped by module name.
module_enums: BTreeMap<String, Vec<EnumInfo>>Enums grouped by module name.
func_table: Vec<FuncEntry>All exportable functions sorted by (module, class, func) for FuncId assignment.
module_deps: BTreeMap<String, BTreeSet<String>>Module name → set of other modules whose types it references.
Drives feature dependency emission in the generated rusteal-bindings/Cargo.toml.
Implementations§
Source§impl CodegenContext
impl CodegenContext
pub fn new( classes: Vec<ClassInfo>, structs: Vec<StructInfo>, enums: Vec<EnumInfo>, config: &CodegenConfig, ) -> Self
Sourcepub fn is_type_available(&self, type_name: &str) -> bool
pub fn is_type_available(&self, type_name: &str) -> bool
Check if a type (class, struct, or enum) exists in an enabled module.
Sourcepub fn module_for_package(&self, package: &str) -> Option<&str>
pub fn module_for_package(&self, package: &str) -> Option<&str>
Get the module name for a package.
Sourcepub fn feature_for_module(&self, module: &str) -> Option<&str>
pub fn feature_for_module(&self, module: &str) -> Option<&str>
Get the Cargo feature name for a module.
Sourcepub fn enum_actual_repr(&self, enum_name: &str) -> Option<&'static str>
pub fn enum_actual_repr(&self, enum_name: &str) -> Option<&'static str>
Get the actual Rust repr type for an enum, accounting for signed promotion.
This must match the logic in rust_gen/enums.rs.