Skip to content

Commit 0243336

Browse files
author
Andrew J Westlake
committed
Added warning for removal of deprecated functions in 0.16, removed some obsolete usage info for cancellable variants
1 parent a3a7217 commit 0243336

File tree

4 files changed

+39
-24
lines changed

4 files changed

+39
-24
lines changed

src/async_std.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ where
211211

212212
/// Convert a Rust Future into a Python awaitable
213213
///
214+
/// __This function will be removed in `v0.16`__
215+
///
214216
/// # Arguments
215217
/// * `event_loop` - The Python event loop that the awaitable should be attached to
216218
/// * `fut` - The Rust future to be converted
@@ -285,8 +287,10 @@ where
285287
/// Convert a Rust Future into a Python awaitable
286288
///
287289
/// __This function was deprecated in favor of [`future_into_py_with_locals`] in `v0.15` because
288-
/// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
289-
/// replaced with [`future_into_py_with_locals`].__
290+
/// it became the default behaviour. In `v0.15`, any calls to this function should be replaced with
291+
/// [`future_into_py_with_locals`]__
292+
///
293+
/// __This function will be removed in `v0.16`__
290294
///
291295
/// # Arguments
292296
/// * `event_loop` - The Python event loop that the awaitable should be attached to
@@ -357,13 +361,12 @@ where
357361

358362
/// Convert a Rust Future into a Python awaitable
359363
///
360-
/// Unlike [`future_into_py`], this function will stop the Rust future from running when
361-
/// the `asyncio.Future` is cancelled from Python.
362-
///
363364
/// __This function was deprecated in favor of [`future_into_py`] in `v0.15` because
364365
/// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
365366
/// replaced with [`future_into_py`].__
366367
///
368+
/// __This function will be removed in `v0.16`__
369+
///
367370
/// # Arguments
368371
/// * `py` - The current PyO3 GIL guard
369372
/// * `fut` - The Rust future to be converted
@@ -399,6 +402,8 @@ where
399402

400403
/// Convert a `!Send` Rust Future into a Python awaitable
401404
///
405+
/// __This function will be removed in `v0.16`__
406+
///
402407
/// # Arguments
403408
/// * `event_loop` - The Python event loop that the awaitable should be attached to
404409
/// * `fut` - The Rust future to be converted
@@ -507,9 +512,11 @@ where
507512
/// Convert a `!Send` Rust Future into a Python awaitable
508513
///
509514
/// __This function was deprecated in favor of [`local_future_into_py_with_locals`] in `v0.15` because
510-
/// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
515+
/// it became the default behaviour. In `v0.15`, any calls to this function should be
511516
/// replaced with [`local_future_into_py_with_locals`].__
512517
///
518+
/// __This function will be removed in `v0.16`__
519+
///
513520
/// # Arguments
514521
/// * `event_loop` - The Python event loop that the awaitable should be attached to
515522
/// * `fut` - The Rust future to be converted
@@ -609,13 +616,12 @@ where
609616

610617
/// Convert a `!Send` Rust Future into a Python awaitable
611618
///
612-
/// Unlike [`local_future_into_py`], this function will stop the Rust future from running when
613-
/// the `asyncio.Future` is cancelled from Python.
614-
///
615619
/// __This function was deprecated in favor of [`local_future_into_py`] in `v0.15` because
616620
/// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
617621
/// replaced with [`local_future_into_py`].__
618622
///
623+
/// __This function will be removed in `v0.16`__
624+
///
619625
/// # Arguments
620626
/// * `py` - The current PyO3 GIL guard
621627
/// * `fut` - The Rust future to be converted

src/generic.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ where
580580

581581
/// Convert a Rust Future into a Python awaitable with a generic runtime
582582
///
583-
/// __
583+
/// __This function will be removed in `v0.16`__
584584
///
585585
/// # Arguments
586586
/// * `event_loop` - The Python event loop that the awaitable should be attached to
@@ -764,7 +764,7 @@ impl PyDoneCallback {
764764
/// Convert a Rust Future into a Python awaitable with a generic runtime
765765
///
766766
/// __This function was deprecated in favor of [`future_into_py_with_locals`] in `v0.15` because
767-
/// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
767+
/// it became the default behaviour. In `v0.15`, any calls to this function should be
768768
/// replaced with [`future_into_py_with_locals`].__
769769
///
770770
/// __In `v0.16` this function will be removed__
@@ -1345,9 +1345,11 @@ where
13451345
/// Convert a `!Send` Rust Future into a Python awaitable with a generic runtime
13461346
///
13471347
/// __This function was deprecated in favor of [`local_future_into_py_with_locals`] in `v0.15` because
1348-
/// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
1348+
/// it became the default behaviour. In `v0.15`, any calls to this function should be
13491349
/// replaced with [`local_future_into_py_with_locals`].__
13501350
///
1351+
/// __This function will be removed in `v0.16`__
1352+
///
13511353
/// # Arguments
13521354
/// * `event_loop` - The Python event loop that the awaitable should be attached to
13531355
/// * `fut` - The Rust future to be converted
@@ -1564,13 +1566,12 @@ where
15641566
}
15651567
/// Convert a Rust Future into a Python awaitable with a generic runtime
15661568
///
1567-
/// Unlike [`local_future_into_py`], this function will stop the Rust future from running when the
1568-
/// `asyncio.Future` is cancelled from Python.
1569-
///
15701569
/// __This function was deprecated in favor of [`local_future_into_py`] in `v0.15` because
15711570
/// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
15721571
/// replaced with [`local_future_into_py`].__
15731572
///
1573+
/// __This function will be removed in `v0.16`__
1574+
///
15741575
/// # Arguments
15751576
/// * `py` - The current PyO3 GIL guard
15761577
/// * `fut` - The Rust future to be converted

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ fn call_soon_threadsafe(
562562
/// simply awaits the result through the `futures::channel::oneshot::Receiver<PyResult<PyObject>>`.
563563
///
564564
/// # Arguments
565-
/// * `event_loop` - The Python event loop that the awaitable should be attached to
565+
/// * `locals` - The Python event loop and context to be used for the provided awaitable
566566
/// * `awaitable` - The Python `awaitable` to be converted
567567
///
568568
/// # Examples
@@ -639,6 +639,8 @@ pub fn into_future_with_locals(
639639
/// `futures::channel::oneshot::Sender<PyResult<PyObject>>` and the future returned by this function
640640
/// simply awaits the result through the `futures::channel::oneshot::Receiver<PyResult<PyObject>>`.
641641
///
642+
/// __This function will be removed in `v0.16`__
643+
///
642644
/// # Arguments
643645
/// * `event_loop` - The Python event loop that the awaitable should be attached to
644646
/// * `awaitable` - The Python `awaitable` to be converted

src/tokio.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ where
228228

229229
/// Convert a Rust Future into a Python awaitable
230230
///
231+
/// __This function will be removed in `v0.16`__
232+
///
231233
/// # Arguments
232234
/// * `event_loop` - The Python event loop that the awaitable should be attached to
233235
/// * `fut` - The Rust future to be converted
@@ -302,9 +304,11 @@ where
302304
/// Convert a Rust Future into a Python awaitable
303305
///
304306
/// __This function was deprecated in favor of [`future_into_py_with_locals`] in `v0.15` because
305-
/// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
307+
/// it became the default behaviour. In `v0.15`, any calls to this function should be
306308
/// replaced with [`future_into_py_with_locals`].__
307309
///
310+
/// __This function will be removed in `v0.16`__
311+
///
308312
/// # Arguments
309313
/// * `event_loop` - The Python event loop that the awaitable should be attached to
310314
/// * `fut` - The Rust future to be converted
@@ -374,13 +378,12 @@ where
374378

375379
/// Convert a Rust Future into a Python awaitable
376380
///
377-
/// Unlike [`future_into_py`], this function will stop the Rust future from running when
378-
/// the `asyncio.Future` is cancelled from Python.
379-
///
380381
/// __This function was deprecated in favor of [`future_into_py`] in `v0.15` because
381382
/// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
382383
/// replaced with [`future_into_py`].__
383384
///
385+
/// __This function will be removed in `v0.16`__
386+
///
384387
/// # Arguments
385388
/// * `py` - The current PyO3 GIL guard
386389
/// * `fut` - The Rust future to be converted
@@ -416,6 +419,8 @@ where
416419

417420
/// Convert a `!Send` Rust Future into a Python awaitable
418421
///
422+
/// __This function will be removed in `v0.16`__
423+
///
419424
/// # Arguments
420425
/// * `event_loop` - The Python event loop that the awaitable should be attached to
421426
/// * `fut` - The Rust future to be converted
@@ -556,9 +561,11 @@ where
556561
/// Convert a `!Send` Rust Future into a Python awaitable
557562
///
558563
/// __This function was deprecated in favor of [`local_future_into_py_with_locals`] in `v0.15` because
559-
/// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
564+
/// it became the default behaviour. In `v0.15`, any calls to this function should be
560565
/// replaced with [`local_future_into_py_with_locals`].__
561566
///
567+
/// __This function will be removed in `v0.16`__
568+
///
562569
/// # Arguments
563570
/// * `event_loop` - The Python event loop that the awaitable should be attached to
564571
/// * `fut` - The Rust future to be converted
@@ -692,13 +699,12 @@ where
692699

693700
/// Convert a `!Send` Rust Future into a Python awaitable
694701
///
695-
/// Unlike [`local_future_into_py`], this function will stop the Rust future from running when
696-
/// the `asyncio.Future` is cancelled from Python.
697-
///
698702
/// __This function was deprecated in favor of [`local_future_into_py`] in `v0.15` because
699703
/// it became the default behaviour. In `v0.15`, any calls to this function can be seamlessly
700704
/// replaced with [`local_future_into_py`].__
701705
///
706+
/// __This function will be removed in `v0.16`__
707+
///
702708
/// # Arguments
703709
/// * `py` - The current PyO3 GIL guard
704710
/// * `fut` - The Rust future to be converted

0 commit comments

Comments
 (0)