Skip to main content

CodegenContext

Struct CodegenContext 

Source
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>,
}
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.

Implementations§

Source§

impl CodegenContext

Source

pub fn new( classes: Vec<ClassInfo>, structs: Vec<StructInfo>, enums: Vec<EnumInfo>, config: &CodegenConfig, ) -> Self

Source

pub fn is_type_available(&self, type_name: &str) -> bool

Check if a type (class, struct, or enum) exists in an enabled module.

Source

pub fn module_for_package(&self, package: &str) -> Option<&str>

Get the module name for a package.

Source

pub fn feature_for_module(&self, module: &str) -> Option<&str>

Get the Cargo feature name for a module.

Source

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.

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> 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, 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.