godot_core/task/
mod.rs

1/*
2 * Copyright (c) godot-rust; Bromeon and contributors.
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
6 */
7
8//! Integrates async rust code with the engine.
9//!
10//! This module contains:
11//! - Implementations of [`Future`](std::future::Future) for [`Signal`](crate::builtin::Signal) and [`TypedSignal`](crate::registry::signal::TypedSignal).
12//! - A way to [`spawn`] new async tasks by using the engine as the async runtime.
13
14mod async_runtime;
15mod futures;
16
17// Public re-exports
18pub use async_runtime::{spawn, TaskHandle};
19pub use futures::{
20    DynamicSend, FallibleSignalFuture, FallibleSignalFutureError, IntoDynamicSend, SignalFuture,
21};
22
23// For use in integration tests.
24#[cfg(feature = "trace")] #[cfg_attr(published_docs, doc(cfg(feature = "trace")))]
25mod reexport_test {
26    pub use super::async_runtime::has_godot_task_panicked;
27    pub use super::futures::{create_test_signal_future_resolver, SignalFutureResolver};
28}
29
30#[cfg(feature = "trace")] #[cfg_attr(published_docs, doc(cfg(feature = "trace")))]
31pub use reexport_test::*;
32
33// Crate-local re-exports.
34mod reexport_crate {
35    pub(crate) use super::async_runtime::cleanup;
36    pub(crate) use super::futures::{impl_dynamic_send, ThreadConfined};
37}
38
39pub(crate) use reexport_crate::*;