forked from godot-rust/gdext
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
116: Make `Inherits<T>` reflexive, with implied `GodotClass` bound r=Bromeon a=Bromeon Previously, it was hard to express polymorphism such as "anything that is a Node", including both Node and derived classes (for example in function parameters). This is now straightforward and also doesn't require a GodotClass bound anymore: ```rs fn print_node<T>(node: Gd<T>) where T: Inherits<Node> { let node = node.upcast(); // Gd<Node> inferred ... // use it } ``` Also adds a couple of tests, as well as a minor panic improvement when invoking Godot from test/doctest. Co-authored-by: Jan Haller <bromeon@gmail.com>
- Loading branch information
Showing
3 changed files
with
143 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters