Skip to content

Commit 75d6bcb

Browse files
ecobiubiuparasyteBromeon
authored
Merge #867
867: Implement methods on Rect2 and Aabb r=Bromeon a=parasyte The docs are based on the Godot documentation for these types, and the code is based on the C++ that implements them. Only documented methods are implemented here. This is especially notable for the `Aabb` type, which has many methods in C++ which are not documented for GDScript. I also took some liberties with a few method names and types. For instance, `Rect2::grow_margin` takes an enum argument, and `Aabb::get_endpoint` returns `Option<Vector3>`. These are different from the GDScript counterparts. `Aabb::get_area` was renamed to `Aabb::get_volume`, etc. Finally, I haven't added any tests for `Aabb` because I did that file last and got bored/lazy before writing any tests (this is what happens when you are not adamant about TDD). The `Rect2` tests did help find plenty of minor bugs, so it is worthwhile to test `Aabb`. Closes #864 Co-authored-by: Jay Oster <[email protected]> Co-authored-by: Jan Haller <[email protected]>
2 parents 9b4cc69 + fb92d06 commit 75d6bcb

File tree

6 files changed

+989
-13
lines changed

6 files changed

+989
-13
lines changed

bindings-generator/src/api.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,7 @@ impl Api {
3939
}
4040

4141
pub fn find_class(&self, name: &str) -> Option<&GodotClass> {
42-
for class in &self.classes {
43-
if class.name == name {
44-
return Some(class);
45-
}
46-
}
47-
48-
None
42+
self.classes.iter().find(|&class| class.name == name)
4943
}
5044

5145
pub fn class_inherits(&self, class: &GodotClass, base_class_name: &str) -> bool {

0 commit comments

Comments
 (0)