Add more realistic godot::task::spawn example#1581
Conversation
| /// self.bind() | ||
| /// .get_node_as::<Player>("Player") | ||
| /// .signals() | ||
| /// .hit() | ||
| /// .builder() | ||
| /// .connect_other_gd(self, Self::show_messages); |
There was a problem hiding this comment.
Is .builder() necessary here? Can you not just call TypedSignal::connect_other() directly?
There was a problem hiding this comment.
I'll check. I need to verify everything I'm saying before converting this draft to a PR.
There was a problem hiding this comment.
self.bind().get_node_as::<Player>("Player").signals().hit().connect_other() failed in compilation with a complaint of the types not matching.
type mismatch in function arguments
│ expected function signature `for<'a> fn(&'a mut game::Game, godot::prelude::Gd<_>) -> _`
│ found function signature `fn(godot::prelude::Gd<game::Game>, godot::prelude::Gd<_>) -> _`
Connecting this signal is one of the reasons why it took me so long to fit together a future workflow.
|
API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-1581 |
Thank you for the early deep feedback! (I applied all of the changes.) I think you did more thank you need at this step, but I definitely appreciate it. I'll leave another comment when this is closer to being convertible from a draft to a real PR. I want to make sure I am using your time well. |
|
@Bromeon I made some good distance. I'm seeing an issue where I'll look into this more tomorrow and I think the CI will pass. If you have an obvious idea why this is failing it would help a ton. It looks like not all of the code from godot is available in the compiled docs examples? |
|
@Bromeon I see that some features are turned off to make the doc tests faster. It is possible to remove this here and move it to something like the Rust Godot Book? Or is it better to tweak the feature config once I find it? Do you have input? |
Love this. |
Not really, the CI is fixed and I'd rather not make it slower. But you can run tests locally, either through the
Not sure how this relates to the book? |
I'm still new to this... but I'm guessing that there is a way to make the tests ignore lines while still keeping in the documentation. I'll give this a try.
I made a POC PR on the book's repository. Please take a look and I think you will better understand what I'm thinking. When you have time, please give me feedback on what is the preferred direction. |
74e14dd to
7330133
Compare
Co-authored-by: Jan Haller <bromeon@gmail.com>
godot::task::spawn example
|
I removed the Also re-enabled the code block (it was ignored, causing a warning in docs). Since Thanks for your contribution! |

This is a small PR to try to make the example for godot::task::spawn more applicable for standard use cases.