Skip to main content

pytures/
lib.rs

1//! Bidirectional bridge between Rust Futures and Python Coroutines, built on PyO3.
2//!
3//! - [`RustCoroutine`] wraps a Rust [`Future`] as a Python coroutine.
4//! - [`PyAwaitable`] wraps a Python awaitable as a Rust [`Future`].
5
6mod py_as_rs;
7mod rs_as_py;
8
9pub use py_as_rs::PyAwaitable;
10pub use rs_as_py::RustCoroutine;
11
12/// Python module initialization is not thread-safe across threads.
13/// All tests that use the Python interpreter must hold this lock.
14#[cfg(test)]
15pub(crate) static PYTHON_TEST_MUTEX: std::sync::Mutex<()> = std::sync::Mutex::new(());