@@ -209,46 +209,6 @@ where
209209 generic:: run :: < AsyncStdRuntime , F , T > ( py, fut)
210210}
211211
212- /// Convert a Rust Future into a Python awaitable
213- ///
214- /// __This function will be removed in `v0.16`__
215- ///
216- /// # Arguments
217- /// * `event_loop` - The Python event loop that the awaitable should be attached to
218- /// * `fut` - The Rust future to be converted
219- ///
220- /// # Examples
221- ///
222- /// ```
223- /// use std::time::Duration;
224- ///
225- /// use pyo3::prelude::*;
226- ///
227- /// /// Awaitable sleep function
228- /// #[pyfunction]
229- /// fn sleep_for<'p>(py: Python<'p>, secs: &'p PyAny) -> PyResult<&'p PyAny> {
230- /// let secs = secs.extract()?;
231- /// pyo3_asyncio::async_std::future_into_py_with_loop(
232- /// pyo3_asyncio::async_std::get_current_loop(py)?,
233- /// async move {
234- /// async_std::task::sleep(Duration::from_secs(secs)).await;
235- /// Python::with_gil(|py| Ok(py.None()))
236- /// }
237- /// )
238- /// }
239- /// ```
240- #[ deprecated(
241- since = "0.15.0" ,
242- note = "Use pyo3_asyncio::async_std::future_into_py_with_locals instead"
243- ) ]
244- #[ allow( deprecated) ]
245- pub fn future_into_py_with_loop < F > ( event_loop : & PyAny , fut : F ) -> PyResult < & PyAny >
246- where
247- F : Future < Output = PyResult < PyObject > > + Send + ' static ,
248- {
249- generic:: future_into_py_with_loop :: < AsyncStdRuntime , F > ( event_loop, fut)
250- }
251-
252212/// Convert a Rust Future into a Python awaitable
253213///
254214/// If the `asyncio.Future` returned by this conversion is cancelled via `asyncio.Future.cancel`,
@@ -300,50 +260,6 @@ where
300260 generic:: future_into_py_with_locals :: < AsyncStdRuntime , F , T > ( py, locals, fut)
301261}
302262
303- /// Convert a Rust Future into a Python awaitable
304- ///
305- /// __This function was deprecated in favor of [`future_into_py_with_locals`] in `v0.15` because
306- /// it became the default behaviour. In `v0.15`, any calls to this function should be replaced with
307- /// [`future_into_py_with_locals`]__
308- ///
309- /// __This function will be removed in `v0.16`__
310- ///
311- /// # Arguments
312- /// * `event_loop` - The Python event loop that the awaitable should be attached to
313- /// * `fut` - The Rust future to be converted
314- ///
315- /// # Examples
316- ///
317- /// ```
318- /// use std::time::Duration;
319- ///
320- /// use pyo3::prelude::*;
321- ///
322- /// /// Awaitable sleep function
323- /// #[pyfunction]
324- /// fn sleep_for<'p>(py: Python<'p>, secs: &'p PyAny) -> PyResult<&'p PyAny> {
325- /// let secs = secs.extract()?;
326- /// pyo3_asyncio::async_std::cancellable_future_into_py_with_loop(
327- /// pyo3_asyncio::async_std::get_current_loop(py)?,
328- /// async move {
329- /// async_std::task::sleep(Duration::from_secs(secs)).await;
330- /// Ok(Python::with_gil(|py| py.None()))
331- /// }
332- /// )
333- /// }
334- /// ```
335- #[ deprecated(
336- since = "0.15.0" ,
337- note = "Use pyo3_asyncio::async_std::future_into_py_with_locals instead"
338- ) ]
339- #[ allow( deprecated) ]
340- pub fn cancellable_future_into_py_with_loop < F > ( event_loop : & PyAny , fut : F ) -> PyResult < & PyAny >
341- where
342- F : Future < Output = PyResult < PyObject > > + Send + ' static ,
343- {
344- generic:: cancellable_future_into_py_with_loop :: < AsyncStdRuntime , F > ( event_loop, fut)
345- }
346-
347263/// Convert a Rust Future into a Python awaitable
348264///
349265/// If the `asyncio.Future` returned by this conversion is cancelled via `asyncio.Future.cancel`,
@@ -390,102 +306,6 @@ where
390306 generic:: future_into_py :: < AsyncStdRuntime , _ , T > ( py, fut)
391307}
392308
393- /// Convert a Rust Future into a Python awaitable
394- ///
395- /// __This function was deprecated in favor of [`future_into_py`] in `v0.15` because
396- /// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
397- /// replaced with [`future_into_py`].__
398- ///
399- /// __This function will be removed in `v0.16`__
400- ///
401- /// # Arguments
402- /// * `py` - The current PyO3 GIL guard
403- /// * `fut` - The Rust future to be converted
404- ///
405- /// # Examples
406- ///
407- /// ```
408- /// use std::time::Duration;
409- ///
410- /// use pyo3::prelude::*;
411- ///
412- /// /// Awaitable sleep function
413- /// #[pyfunction]
414- /// fn sleep_for<'p>(py: Python<'p>, secs: &'p PyAny) -> PyResult<&'p PyAny> {
415- /// let secs = secs.extract()?;
416- /// pyo3_asyncio::async_std::cancellable_future_into_py(py, async move {
417- /// async_std::task::sleep(Duration::from_secs(secs)).await;
418- /// Python::with_gil(|py| Ok(py.None()))
419- /// })
420- /// }
421- /// ```
422- #[ deprecated(
423- since = "0.15.0" ,
424- note = "Use pyo3_asyncio::async_std::future_into_py instead"
425- ) ]
426- #[ allow( deprecated) ]
427- pub fn cancellable_future_into_py < F > ( py : Python , fut : F ) -> PyResult < & PyAny >
428- where
429- F : Future < Output = PyResult < PyObject > > + Send + ' static ,
430- {
431- generic:: cancellable_future_into_py :: < AsyncStdRuntime , _ > ( py, fut)
432- }
433-
434- /// Convert a `!Send` Rust Future into a Python awaitable
435- ///
436- /// __This function will be removed in `v0.16`__
437- ///
438- /// # Arguments
439- /// * `event_loop` - The Python event loop that the awaitable should be attached to
440- /// * `fut` - The Rust future to be converted
441- ///
442- /// # Examples
443- ///
444- /// ```
445- /// use std::{rc::Rc, time::Duration};
446- ///
447- /// use pyo3::prelude::*;
448- ///
449- /// /// Awaitable non-send sleep function
450- /// #[pyfunction]
451- /// fn sleep_for(py: Python, secs: u64) -> PyResult<&PyAny> {
452- /// // Rc is non-send so it cannot be passed into pyo3_asyncio::async_std::future_into_py
453- /// let secs = Rc::new(secs);
454- /// Ok(pyo3_asyncio::async_std::local_future_into_py_with_loop(
455- /// pyo3_asyncio::async_std::get_current_loop(py)?,
456- /// async move {
457- /// async_std::task::sleep(Duration::from_secs(*secs)).await;
458- /// Ok(Python::with_gil(|py| py.None()))
459- /// }
460- /// )?.into())
461- /// }
462- ///
463- /// # #[cfg(all(feature = "async-std-runtime", feature = "attributes"))]
464- /// #[pyo3_asyncio::async_std::main]
465- /// async fn main() -> PyResult<()> {
466- /// Python::with_gil(|py| {
467- /// let py_future = sleep_for(py, 1)?;
468- /// pyo3_asyncio::async_std::into_future(py_future)
469- /// })?
470- /// .await?;
471- ///
472- /// Ok(())
473- /// }
474- /// # #[cfg(not(all(feature = "async-std-runtime", feature = "attributes")))]
475- /// # fn main() {}
476- /// ```
477- #[ deprecated(
478- since = "0.15.0" ,
479- note = "Use pyo3_asyncio::async_std::local_future_into_py_with_locals instead"
480- ) ]
481- #[ allow( deprecated) ]
482- pub fn local_future_into_py_with_loop < F > ( event_loop : & PyAny , fut : F ) -> PyResult < & PyAny >
483- where
484- F : Future < Output = PyResult < PyObject > > + ' static ,
485- {
486- generic:: local_future_into_py_with_loop :: < AsyncStdRuntime , _ > ( event_loop, fut)
487- }
488-
489309/// Convert a `!Send` Rust Future into a Python awaitable
490310///
491311/// If the `asyncio.Future` returned by this conversion is cancelled via `asyncio.Future.cancel`,
@@ -556,65 +376,6 @@ where
556376 generic:: local_future_into_py_with_locals :: < AsyncStdRuntime , _ , T > ( py, locals, fut)
557377}
558378
559- /// Convert a `!Send` Rust Future into a Python awaitable
560- ///
561- /// __This function was deprecated in favor of [`local_future_into_py_with_locals`] in `v0.15` because
562- /// it became the default behaviour. In `v0.15`, any calls to this function should be
563- /// replaced with [`local_future_into_py_with_locals`].__
564- ///
565- /// __This function will be removed in `v0.16`__
566- ///
567- /// # Arguments
568- /// * `event_loop` - The Python event loop that the awaitable should be attached to
569- /// * `fut` - The Rust future to be converted
570- ///
571- /// # Examples
572- ///
573- /// ```
574- /// use std::{rc::Rc, time::Duration};
575- ///
576- /// use pyo3::prelude::*;
577- ///
578- /// /// Awaitable non-send sleep function
579- /// #[pyfunction]
580- /// fn sleep_for(py: Python, secs: u64) -> PyResult<&PyAny> {
581- /// // Rc is non-send so it cannot be passed into pyo3_asyncio::async_std::future_into_py
582- /// let secs = Rc::new(secs);
583- /// Ok(pyo3_asyncio::async_std::local_cancellable_future_into_py_with_loop(
584- /// pyo3_asyncio::async_std::get_current_loop(py)?,
585- /// async move {
586- /// async_std::task::sleep(Duration::from_secs(*secs)).await;
587- /// Python::with_gil(|py| Ok(py.None()))
588- /// }
589- /// )?.into())
590- /// }
591- ///
592- /// # #[cfg(all(feature = "async-std-runtime", feature = "attributes"))]
593- /// #[pyo3_asyncio::async_std::main]
594- /// async fn main() -> PyResult<()> {
595- /// Python::with_gil(|py| {
596- /// let py_future = sleep_for(py, 1)?;
597- /// pyo3_asyncio::async_std::into_future(py_future)
598- /// })?
599- /// .await?;
600- ///
601- /// Ok(())
602- /// }
603- /// # #[cfg(not(all(feature = "async-std-runtime", feature = "attributes")))]
604- /// # fn main() {}
605- /// ```
606- #[ deprecated(
607- since = "0.15.0" ,
608- note = "Use pyo3_asyncio::async_std::local_future_into_py_with_locals instead"
609- ) ]
610- #[ allow( deprecated) ]
611- pub fn local_cancellable_future_into_py_with_loop < F > ( event_loop : & PyAny , fut : F ) -> PyResult < & PyAny >
612- where
613- F : Future < Output = PyResult < PyObject > > + ' static ,
614- {
615- generic:: local_cancellable_future_into_py_with_loop :: < AsyncStdRuntime , _ > ( event_loop, fut)
616- }
617-
618379/// Convert a `!Send` Rust Future into a Python awaitable
619380///
620381/// If the `asyncio.Future` returned by this conversion is cancelled via `asyncio.Future.cancel`,
@@ -676,62 +437,6 @@ where
676437 generic:: local_future_into_py :: < AsyncStdRuntime , _ , T > ( py, fut)
677438}
678439
679- /// Convert a `!Send` Rust Future into a Python awaitable
680- ///
681- /// __This function was deprecated in favor of [`local_future_into_py`] in `v0.15` because
682- /// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
683- /// replaced with [`local_future_into_py`].__
684- ///
685- /// __This function will be removed in `v0.16`__
686- ///
687- /// # Arguments
688- /// * `py` - The current PyO3 GIL guard
689- /// * `fut` - The Rust future to be converted
690- ///
691- /// # Examples
692- ///
693- /// ```
694- /// use std::{rc::Rc, time::Duration};
695- ///
696- /// use pyo3::prelude::*;
697- ///
698- /// /// Awaitable non-send sleep function
699- /// #[pyfunction]
700- /// fn sleep_for(py: Python, secs: u64) -> PyResult<&PyAny> {
701- /// // Rc is non-send so it cannot be passed into pyo3_asyncio::async_std::future_into_py
702- /// let secs = Rc::new(secs);
703- /// pyo3_asyncio::async_std::local_cancellable_future_into_py(py, async move {
704- /// async_std::task::sleep(Duration::from_secs(*secs)).await;
705- /// Python::with_gil(|py| Ok(py.None()))
706- /// })
707- /// }
708- ///
709- /// # #[cfg(all(feature = "async-std-runtime", feature = "attributes"))]
710- /// #[pyo3_asyncio::async_std::main]
711- /// async fn main() -> PyResult<()> {
712- /// Python::with_gil(|py| {
713- /// let py_future = sleep_for(py, 1)?;
714- /// pyo3_asyncio::async_std::into_future(py_future)
715- /// })?
716- /// .await?;
717- ///
718- /// Ok(())
719- /// }
720- /// # #[cfg(not(all(feature = "async-std-runtime", feature = "attributes")))]
721- /// # fn main() {}
722- /// ```
723- #[ deprecated(
724- since = "0.15.0" ,
725- note = "Use pyo3_asyncio::async_std::local_future_into_py instead"
726- ) ]
727- #[ allow( deprecated) ]
728- pub fn local_cancellable_future_into_py < F > ( py : Python , fut : F ) -> PyResult < & PyAny >
729- where
730- F : Future < Output = PyResult < PyObject > > + ' static ,
731- {
732- generic:: local_cancellable_future_into_py :: < AsyncStdRuntime , _ > ( py, fut)
733- }
734-
735440/// Convert a Python `awaitable` into a Rust Future
736441///
737442/// This function converts the `awaitable` into a Python Task using `run_coroutine_threadsafe`. A
0 commit comments