pub struct TypeCollector {
pub known_structs: HashMap<String, StructInfo>,
}Expand description
Utility for collecting and organizing types for bindings generation
This struct provides filtering and transformation utilities that sit between the analysis phase (which produces TypeStructure) and the generation phase (which consumes filtered types and contexts). It acts as a one-stop-shop for filtering unused code and collecting only the types needed for generation.
Fields§
§known_structs: HashMap<String, StructInfo>Implementations§
Source§impl TypeCollector
impl TypeCollector
pub fn new() -> Self
Sourcepub fn collect_used_types(
&self,
commands: &[CommandInfo],
all_structs: &HashMap<String, StructInfo>,
) -> HashMap<String, StructInfo>
pub fn collect_used_types( &self, commands: &[CommandInfo], all_structs: &HashMap<String, StructInfo>, ) -> HashMap<String, StructInfo>
Filter only the types used by commands
Sourcepub fn collect_referenced_types_from_structure(
type_structure: &TypeStructure,
used_types: &mut HashSet<String>,
)
pub fn collect_referenced_types_from_structure( type_structure: &TypeStructure, used_types: &mut HashSet<String>, )
Recursively collect custom type names from TypeStructure Works directly with structured type information instead of string parsing
Sourcepub fn create_command_contexts<V: TypeVisitor>(
&self,
commands: &[CommandInfo],
visitor: &V,
analyzer: &CommandAnalyzer,
config: &GenerateConfig,
) -> Vec<CommandContext>
pub fn create_command_contexts<V: TypeVisitor>( &self, commands: &[CommandInfo], visitor: &V, analyzer: &CommandAnalyzer, config: &GenerateConfig, ) -> Vec<CommandContext>
Create CommandContext instances from CommandInfo using the provided visitor
Sourcepub fn create_event_contexts<V: TypeVisitor>(
&self,
events: &[EventInfo],
visitor: &V,
analyzer: &CommandAnalyzer,
config: &GenerateConfig,
) -> Vec<EventContext>
pub fn create_event_contexts<V: TypeVisitor>( &self, events: &[EventInfo], visitor: &V, analyzer: &CommandAnalyzer, config: &GenerateConfig, ) -> Vec<EventContext>
Create EventContext instances from EventInfo using the provided visitor
Sourcepub fn create_struct_contexts<V: TypeVisitor>(
&self,
used_structs: &HashMap<String, StructInfo>,
visitor: &V,
config: &GenerateConfig,
) -> Vec<StructContext>
pub fn create_struct_contexts<V: TypeVisitor>( &self, used_structs: &HashMap<String, StructInfo>, visitor: &V, config: &GenerateConfig, ) -> Vec<StructContext>
Create StructContext instances from StructInfo using the provided visitor
Sourcepub fn create_field_contexts<V: TypeVisitor>(
&self,
struct_info: &StructInfo,
visitor: &V,
config: &GenerateConfig,
) -> Vec<FieldContext>
pub fn create_field_contexts<V: TypeVisitor>( &self, struct_info: &StructInfo, visitor: &V, config: &GenerateConfig, ) -> Vec<FieldContext>
Create FieldContext instances from StructInfo using the provided visitor