Crate gdnative_async
source ·Expand description
Runtime async support for godot-rust.
This crate contains types and functions that enable using async code with godot-rust.
Safety assumptions
This crate assumes that all user non-Rust code follow the official threading guidelines.
Structs
Adapter for async methods that implements
Method
and can be registered.Context for creating
yield
-like futures in async methods.A helper structure for working around naming future types. See
Spawner::spawn
.Adapter for methods whose arguments are statically determined. If the arguments would fail to
type check, the method will print the errors to Godot’s debug console and return
null
.Traits
Trait for async methods. When exported, such methods return
FunctionState
-like
objects that can be manually resumed or yielded to completion.Trait for async methods whose argument lists are known at compile time. Not to
be confused with a “static method”. When exported, such methods return
FunctionState
-like objects that can be manually resumed or yielded to completion.Functions
Adds required supporting NativeScript classes to
handle
. This must be called once and
only once per initialization.Sets the global executor for the current thread to a
Box<dyn LocalSpawn>
. This value is leaked.Sets the global executor for the current thread to a
&'static dyn LocalSpawn
.Releases all observers still in use. This should be called in the
godot_gdnative_terminate
callback.