@@ -34,16 +34,6 @@ class UnsafeReason(Enum):
34
34
CUSTOM = "custom"
35
35
36
36
37
- class UnsafeBlock (BaseModel ):
38
- """Represents an unsafe block within Rust code."""
39
-
40
- start_line : int
41
- end_line : int
42
- reasons : List [UnsafeReason ] = Field (default_factory = list )
43
- explanation : Optional [str ] = None # Documentation explaining why unsafe is needed
44
- containing_function : Optional [str ] = None
45
-
46
-
47
37
class RustType (BaseModel ):
48
38
"""Represents a Rust type."""
49
39
@@ -66,6 +56,67 @@ class RustAttribute(BaseModel):
66
56
is_inner : bool = False # #![foo] vs #[foo]
67
57
68
58
59
+ class RustGenericParam (BaseModel ):
60
+ """Represents a generic type parameter in Rust."""
61
+
62
+ name : str
63
+ bounds : List [str ] = Field (default_factory = list ) # Trait bounds
64
+ default_type : Optional [str ] = None
65
+ is_const : bool = False # For const generics
66
+
67
+
68
+ class RustLifetimeParam (BaseModel ):
69
+ """Represents a lifetime parameter in Rust."""
70
+
71
+ name : str
72
+ bounds : List [str ] = Field (default_factory = list ) # Lifetime bounds
73
+
74
+
75
+ class RustParameter (BaseModel ):
76
+ """Represents a function parameter in Rust."""
77
+
78
+ name : str
79
+ type : RustType
80
+ is_self : bool = False # For methods (self, &self, &mut self)
81
+ is_mut : bool = False # For mutable bindings
82
+ default_value : Optional [str ] = None
83
+
84
+
85
+ class RustCallSite (BaseModel ):
86
+ """Represents a location where a function is called."""
87
+
88
+ line_number : int
89
+ caller_function : Optional [str ] = None
90
+ caller_module : Optional [str ] = None
91
+ argument_types : List [RustType ] = Field (default_factory = list )
92
+ is_unsafe_context : bool = False
93
+
94
+
95
+ class RustVariableDeclaration (BaseModel ):
96
+ """Represents a variable declaration in Rust."""
97
+
98
+ name : str
99
+ type : Optional [RustType ] = None
100
+ is_mut : bool = False
101
+ is_static : bool = False
102
+ is_const : bool = False
103
+ initializer : Optional [str ] = None
104
+ visibility : RustVisibility = RustVisibility .PRIVATE
105
+ doc_comment : Optional [str ] = None
106
+ attributes : List [RustAttribute ] = Field (default_factory = list )
107
+ line_number : int
108
+
109
+
110
+ class UnsafeBlock (BaseModel ):
111
+ """Represents an unsafe block within Rust code."""
112
+
113
+ start_line : int
114
+ end_line : int
115
+ reasons : List [UnsafeReason ] = Field (default_factory = list )
116
+ explanation : Optional [str ] = None # Documentation explaining why unsafe is needed
117
+ containing_function : Optional [str ] = None
118
+
119
+
69
120
class SafetyAnalysis (BaseModel ):
70
121
"""Analyzes and tracks safety-related information."""
71
122
0 commit comments