Function pyo3_asyncio::async_std::run_until_complete [−][src]
pub fn run_until_complete<F>(py: Python<'_>, fut: F) -> PyResult<()> where
F: Future<Output = PyResult<()>> + Send + 'static,
Expand description
Run the event loop until the given Future completes
The event loop runs until the given future is complete.
After this function returns, the event loop can be resumed with either run_until_complete
or
crate::run_forever
Arguments
py
- The current PyO3 GIL guardfut
- The future to drive to completion
Examples
pyo3_asyncio::async_std::run_until_complete(py, async move { async_std::task::sleep(Duration::from_secs(1)).await; Ok(()) })?;