Open
Description
I think deferred method calls could be improved. I'd like to propose the introduction of a deferred()
helper struct similar to signals()
as introduced in #1000
So the following
#[func]
pub fn do_something(&mut self, my_resource: Gd<MyResource>)
could allow to do something like this
// call method deferred
self.deferred().do_something(my_resource);
// or maybe even async
self.deferred().do_something(my_resource).await;
and would improve the less type-safe and more verbose syntax of
self.base_mut().call_deferred("do_something", &[my_resource.to_variant()])
As I understand it, `#[func]' already tells us, which methods can be deferred, but since visibility of godot and rust is orthogonal, it should require both here.
Maybe this could even integrate with the signals api somehow to make setup of deferred signals less verbose.
Maybe it's just the way I program and that can be improved, but I use a lot of deferred method calls, when processing game state.