File tree Expand file tree Collapse file tree 3 files changed +5
-17
lines changed Expand file tree Collapse file tree 3 files changed +5
-17
lines changed Original file line number Diff line number Diff line change 1
- use std:: collections:: HashMap ;
1
+ use std:: collections:: { HashMap , HashSet } ;
2
2
use serde_json;
3
3
4
4
pub struct Api {
5
5
pub classes : Vec < GodotClass > ,
6
- pub api_underscore : Vec < String > ,
6
+ pub api_underscore : HashSet < String > ,
7
7
}
8
8
9
9
impl Api {
10
10
pub fn new ( ) -> Self {
11
11
let mut api = Api {
12
12
classes : serde_json:: from_slice ( get_api_json ( ) ) . expect ( "Failed to parse the API description" ) ,
13
- api_underscore : Default :: default ( ) ,
13
+ api_underscore : Default :: default ( ) ,
14
14
} ;
15
15
16
16
api. strip_leading_underscores ( ) ;
@@ -44,7 +44,7 @@ impl Api {
44
44
for class in & mut self . classes {
45
45
if class. name . starts_with ( '_' ) {
46
46
class. name = class. name [ 1 ..] . to_string ( ) ;
47
- self . api_underscore . push ( class. name . clone ( ) ) ;
47
+ self . api_underscore . insert ( class. name . clone ( ) ) ;
48
48
}
49
49
for method in & mut class. methods {
50
50
if method. return_type . starts_with ( '_' ) {
Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ fn generate_class_bindings(
167
167
168
168
// methods and method table
169
169
{
170
- let has_underscore = api. api_underscore . iter ( ) . any ( |name| class. name . starts_with ( name ) ) ;
170
+ let has_underscore = api. api_underscore . contains ( & class. name ) ;
171
171
generate_method_table ( output_method_table, class, has_underscore) ?;
172
172
173
173
for method in & class. methods {
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments