Skip to content

Commit 6131e5d

Browse files
author
Andrew J Westlake
committed
Deprecated generic with_loop and cancellable variants, fixed warnings
1 parent 64f08c8 commit 6131e5d

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

src/async_std.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ where
280280
since = "0.15.0",
281281
note = "Use pyo3_asyncio::async_std::future_into_py_with_locals instead"
282282
)]
283+
#[allow(deprecated)]
283284
pub fn future_into_py_with_loop<F>(event_loop: &PyAny, fut: F) -> PyResult<&PyAny>
284285
where
285286
F: Future<Output = PyResult<PyObject>> + Send + 'static,
@@ -324,6 +325,7 @@ where
324325
since = "0.15.0",
325326
note = "Use pyo3_asyncio::async_std::future_into_py_with_locals instead"
326327
)]
328+
#[allow(deprecated)]
327329
pub fn cancellable_future_into_py_with_loop<F>(event_loop: &PyAny, fut: F) -> PyResult<&PyAny>
328330
where
329331
F: Future<Output = PyResult<PyObject>> + Send + 'static,
@@ -395,6 +397,7 @@ where
395397
since = "0.15.0",
396398
note = "Use pyo3_asyncio::async_std::future_into_py instead"
397399
)]
400+
#[allow(deprecated)]
398401
pub fn cancellable_future_into_py<F>(py: Python, fut: F) -> PyResult<&PyAny>
399402
where
400403
F: Future<Output = PyResult<PyObject>> + Send + 'static,
@@ -447,6 +450,7 @@ where
447450
since = "0.15.0",
448451
note = "Use pyo3_asyncio::async_std::local_future_into_py_with_locals instead"
449452
)]
453+
#[allow(deprecated)]
450454
pub fn local_future_into_py_with_loop<F>(event_loop: &PyAny, fut: F) -> PyResult<&PyAny>
451455
where
452456
F: Future<Output = PyResult<PyObject>> + 'static,
@@ -506,6 +510,7 @@ where
506510
since = "0.15.0",
507511
note = "Use pyo3_asyncio::async_std::local_future_into_py_with_locals instead"
508512
)]
513+
#[allow(deprecated)]
509514
pub fn local_cancellable_future_into_py_with_loop<F>(event_loop: &PyAny, fut: F) -> PyResult<&PyAny>
510515
where
511516
F: Future<Output = PyResult<PyObject>> + 'static,
@@ -607,6 +612,7 @@ where
607612
since = "0.15.0",
608613
note = "Use pyo3_asyncio::async_std::local_future_into_py instead"
609614
)]
615+
#[allow(deprecated)]
610616
pub fn local_cancellable_future_into_py<F>(py: Python, fut: F) -> PyResult<&PyAny>
611617
where
612618
F: Future<Output = PyResult<PyObject>> + 'static,

src/generic.rs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,10 @@ where
649649
/// )
650650
/// }
651651
/// ```
652+
#[deprecated(
653+
since = "0.15.0",
654+
note = "Use pyo3_asyncio::generic::future_into_py_with_locals instead"
655+
)]
652656
pub fn future_into_py_with_loop<R, F>(event_loop: &PyAny, fut: F) -> PyResult<&PyAny>
653657
where
654658
R: Runtime + ContextExt,
@@ -826,6 +830,12 @@ impl PyDoneCallback {
826830
/// )
827831
/// }
828832
/// ```
833+
834+
#[deprecated(
835+
since = "0.15.0",
836+
note = "Use pyo3_asyncio::generic::future_into_py_with_locals instead"
837+
)]
838+
#[allow(deprecated)]
829839
pub fn cancellable_future_into_py_with_loop<R, F>(event_loop: &PyAny, fut: F) -> PyResult<&PyAny>
830840
where
831841
R: Runtime + ContextExt,
@@ -1010,12 +1020,16 @@ where
10101020
/// })
10111021
/// }
10121022
/// ```
1023+
#[deprecated(
1024+
since = "0.15.0",
1025+
note = "Use pyo3_asyncio::generic::future_into_py instead"
1026+
)]
10131027
pub fn cancellable_future_into_py<R, F>(py: Python, fut: F) -> PyResult<&PyAny>
10141028
where
10151029
R: Runtime + ContextExt,
10161030
F: Future<Output = PyResult<PyObject>> + Send + 'static,
10171031
{
1018-
cancellable_future_into_py_with_loop::<R, F>(get_current_loop::<R>(py)?, fut)
1032+
future_into_py::<R, F>(py, fut)
10191033
}
10201034

10211035
/// Convert a Rust Future into a Python awaitable with a generic runtime
@@ -1482,6 +1496,10 @@ where
14821496
/// )
14831497
/// }
14841498
/// ```
1499+
#[deprecated(
1500+
since = "0.15.0",
1501+
note = "Use pyo3_asyncio::generic::local_future_into_py_with_locals instead"
1502+
)]
14851503
pub fn local_cancellable_future_into_py_with_loop<R, F>(
14861504
event_loop: &PyAny,
14871505
fut: F,
@@ -1599,7 +1617,7 @@ where
15991617
R: Runtime + ContextExt + SpawnLocalExt + LocalContextExt,
16001618
F: Future<Output = PyResult<PyObject>> + 'static,
16011619
{
1602-
local_future_into_py_with_loop::<R, F>(get_current_loop::<R>(py)?, fut)
1620+
local_future_into_py_with_locals::<R, F>(py, get_current_locals::<R>(py)?, fut)
16031621
}
16041622
/// Convert a Rust Future into a Python awaitable with a generic runtime
16051623
///
@@ -1711,10 +1729,15 @@ where
17111729
/// )
17121730
/// }
17131731
/// ```
1732+
///
1733+
#[deprecated(
1734+
since = "0.15.0",
1735+
note = "Use pyo3_asyncio::generic::local_future_into_py instead"
1736+
)]
17141737
pub fn local_cancellable_future_into_py<R, F>(py: Python, fut: F) -> PyResult<&PyAny>
17151738
where
17161739
R: Runtime + ContextExt + SpawnLocalExt + LocalContextExt,
17171740
F: Future<Output = PyResult<PyObject>> + 'static,
17181741
{
1719-
local_cancellable_future_into_py_with_loop::<R, F>(get_current_loop::<R>(py)?, fut)
1742+
local_future_into_py::<R, F>(py, fut)
17201743
}

src/tokio.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ where
296296
since = "0.15.0",
297297
note = "Use pyo3_asyncio::tokio::future_into_py_with_locals instead"
298298
)]
299+
#[allow(deprecated)]
299300
pub fn future_into_py_with_loop<F>(event_loop: &PyAny, fut: F) -> PyResult<&PyAny>
300301
where
301302
F: Future<Output = PyResult<PyObject>> + Send + 'static,
@@ -340,6 +341,7 @@ where
340341
since = "0.15.0",
341342
note = "Use pyo3_asyncio::tokio::future_into_py_with_locals instead"
342343
)]
344+
#[allow(deprecated)]
343345
pub fn cancellable_future_into_py_with_loop<F>(event_loop: &PyAny, fut: F) -> PyResult<&PyAny>
344346
where
345347
F: Future<Output = PyResult<PyObject>> + Send + 'static,
@@ -411,6 +413,7 @@ where
411413
since = "0.15.0",
412414
note = "Use pyo3_asyncio::tokio::future_into_py instead"
413415
)]
416+
#[allow(deprecated)]
414417
pub fn cancellable_future_into_py<F>(py: Python, fut: F) -> PyResult<&PyAny>
415418
where
416419
F: Future<Output = PyResult<PyObject>> + Send + 'static,
@@ -479,6 +482,7 @@ where
479482
since = "0.15.0",
480483
note = "Use pyo3_asyncio::tokio::local_future_into_py_with_locals instead"
481484
)]
485+
#[allow(deprecated)]
482486
pub fn local_future_into_py_with_loop<'p, F>(event_loop: &'p PyAny, fut: F) -> PyResult<&PyAny>
483487
where
484488
F: Future<Output = PyResult<PyObject>> + 'static,
@@ -623,6 +627,7 @@ where
623627
since = "0.15.0",
624628
note = "Use pyo3_asyncio::tokio::local_future_into_py_with_locals instead"
625629
)]
630+
#[allow(deprecated)]
626631
pub fn local_cancellable_future_into_py_with_loop<'p, F>(
627632
event_loop: &'p PyAny,
628633
fut: F,
@@ -757,6 +762,7 @@ where
757762
since = "0.15.0",
758763
note = "Use pyo3_asyncio::tokio::local_future_into_py instead"
759764
)]
765+
#[allow(deprecated)]
760766
pub fn local_cancellable_future_into_py<F>(py: Python, fut: F) -> PyResult<&PyAny>
761767
where
762768
F: Future<Output = PyResult<PyObject>> + 'static,

0 commit comments

Comments
 (0)