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§

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.
StaticArgs
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 awaited for a signal or a resume call from Godot. See Context for methods that return this future.

Traits§

AsyncMethod
Trait for async methods. When exported, such methods return FunctionState-like objects that can be manually resumed or yielded to completion.
StaticArgsAsyncMethod
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.