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§
- Async
- Adapter for async methods that implements
Method
and can be registered. - Context
- Context for creating
yield
-like futures in async methods. - Spawner
- A helper structure for working around naming future types. See
Spawner::spawn
. - Static
Args - 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
. - Yield
- Future that can be
await
ed for a signal or aresume
call from Godot. SeeContext
for methods that return this future.
Traits§
- Async
Method - Trait for async methods. When exported, such methods return
FunctionState
-like objects that can be manually resumed or yielded to completion. - Static
Args Async Method - 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§
- register_
runtime - Adds required supporting NativeScript classes to
handle
. This must be called once and only once per initialization. - set_
boxed_ executor - Sets the global executor for the current thread to a
Box<dyn LocalSpawn>
. This value is leaked. - set_
executor - Sets the global executor for the current thread to a
&'static dyn LocalSpawn
. - terminate_
runtime - Releases all observers still in use. This should be called in the
godot_gdnative_terminate
callback.