Module tokio

Source
Expand description

tokio-runtime PyO3 Asyncio functions specific to the tokio runtime

Items marked with <span class=“module-item stab portability” style=“display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;”

unstable-streams are only available when the unstable-streams Cargo feature is enabled:

[dependencies.pyo3-async-runtimes]
version = "0.24"
features = ["unstable-streams"]

Modules§

re_exports
attributes re-exports for macros

Functions§

future_into_py
Convert a Rust Future into a Python awaitable
future_into_py_with_locals
Convert a Rust Future into a Python awaitable
get_current_locals
Either copy the task locals from the current task OR get the current running loop and contextvars from Python.
get_current_loop
Get the current event loop from either Python or Rust async task local context
get_runtime
Get a reference to the current tokio runtime
init
Initialize the Tokio runtime with a custom build
init_with_runtime
Initialize the Tokio runtime with a custom Tokio runtime
into_future
Convert a Python awaitable into a Rust Future
local_future_into_pyDeprecated
Convert a !Send Rust Future into a Python awaitable
local_future_into_py_with_localsDeprecated
Convert a !Send Rust Future into a Python awaitable
run
Run the event loop until the given Future completes
run_until_complete
Run the event loop until the given Future completes
scope
Set the task local event loop for the given future
scope_local
Set the task local event loop for the given !Send future

Attribute Macros§

main
attributes Enables an async main function that uses the tokio runtime.
test
attributes testing Registers a tokio test with the pyo3-asyncio test harness Registers a tokio test with the pyo3-asyncio test harness.