Skip to content

Commit afe74b1

Browse files
author
Andrew J Westlake
committed
Fixed some docs for consistency / readability
1 parent 99335a7 commit afe74b1

File tree

4 files changed

+78
-70
lines changed

4 files changed

+78
-70
lines changed

src/async_std.rs

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
//! <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>async-std-runtime</code></span> PyO3 Asyncio functions specific to the async-std runtime
2+
//!
3+
//! Items marked with
4+
//! <span
5+
//! class="module-item stab portability"
6+
//! style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"
7+
//! ><code>unstable-streams</code></span>
8+
//! are only available when the `unstable-streams` Cargo feature is enabled:
9+
//!
10+
//! ```toml
11+
//! [dependencies.pyo3-asyncio]
12+
//! version = "0.16"
13+
//! features = ["unstable-streams"]
14+
//! ```
15+
116
use std::{any::Any, cell::RefCell, future::Future, panic::AssertUnwindSafe, pin::Pin};
217

318
use async_std::task;
@@ -491,6 +506,10 @@ pub fn into_future(awaitable: &PyAny) -> PyResult<impl Future<Output = PyResult<
491506

492507
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>unstable-streams</code></span> Convert an async generator into a stream
493508
///
509+
/// **This API is marked as unstable** and is only available when the
510+
/// `unstable-streams` crate feature is enabled. This comes with no
511+
/// stability guarantees, and could be changed or removed at any time.
512+
///
494513
/// # Arguments
495514
/// * `gen` - The Python async generator to be converted
496515
///
@@ -534,12 +553,6 @@ pub fn into_future(awaitable: &PyAny) -> PyResult<impl Future<Output = PyResult<
534553
/// # #[cfg(not(all(feature = "unstable-streams", feature = "attributes")))]
535554
/// # fn main() {}
536555
/// ```
537-
///
538-
/// # Availability
539-
///
540-
/// **This API is marked as unstable** and is only available when the
541-
/// `unstable-streams` crate feature is enabled. This comes with no
542-
/// stability guarantees, and could be changed or removed at any time.
543556
#[cfg(feature = "unstable-streams")]
544557
pub fn into_stream_v1<'p>(
545558
gen: &'p PyAny,
@@ -549,6 +562,10 @@ pub fn into_stream_v1<'p>(
549562

550563
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>unstable-streams</code></span> Convert an async generator into a stream
551564
///
565+
/// **This API is marked as unstable** and is only available when the
566+
/// `unstable-streams` crate feature is enabled. This comes with no
567+
/// stability guarantees, and could be changed or removed at any time.
568+
///
552569
/// # Arguments
553570
/// * `locals` - The current task locals
554571
/// * `gen` - The Python async generator to be converted
@@ -596,12 +613,6 @@ pub fn into_stream_v1<'p>(
596613
/// # #[cfg(not(all(feature = "unstable-streams", feature = "attributes")))]
597614
/// # fn main() {}
598615
/// ```
599-
///
600-
/// # Availability
601-
///
602-
/// **This API is marked as unstable** and is only available when the
603-
/// `unstable-streams` crate feature is enabled. This comes with no
604-
/// stability guarantees, and could be changed or removed at any time.
605616
#[cfg(feature = "unstable-streams")]
606617
pub fn into_stream_with_locals_v1<'p>(
607618
locals: TaskLocals,
@@ -612,6 +623,10 @@ pub fn into_stream_with_locals_v1<'p>(
612623

613624
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>unstable-streams</code></span> Convert an async generator into a stream
614625
///
626+
/// **This API is marked as unstable** and is only available when the
627+
/// `unstable-streams` crate feature is enabled. This comes with no
628+
/// stability guarantees, and could be changed or removed at any time.
629+
///
615630
/// # Arguments
616631
/// * `locals` - The current task locals
617632
/// * `gen` - The Python async generator to be converted
@@ -659,12 +674,6 @@ pub fn into_stream_with_locals_v1<'p>(
659674
/// # #[cfg(not(all(feature = "unstable-streams", feature = "attributes")))]
660675
/// # fn main() {}
661676
/// ```
662-
///
663-
/// # Availability
664-
///
665-
/// **This API is marked as unstable** and is only available when the
666-
/// `unstable-streams` crate feature is enabled. This comes with no
667-
/// stability guarantees, and could be changed or removed at any time.
668677
#[cfg(feature = "unstable-streams")]
669678
pub fn into_stream_with_locals_v2<'p>(
670679
locals: TaskLocals,
@@ -675,6 +684,10 @@ pub fn into_stream_with_locals_v2<'p>(
675684

676685
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>unstable-streams</code></span> Convert an async generator into a stream
677686
///
687+
/// **This API is marked as unstable** and is only available when the
688+
/// `unstable-streams` crate feature is enabled. This comes with no
689+
/// stability guarantees, and could be changed or removed at any time.
690+
///
678691
/// # Arguments
679692
/// * `gen` - The Python async generator to be converted
680693
///
@@ -718,10 +731,6 @@ pub fn into_stream_with_locals_v2<'p>(
718731
/// # #[cfg(not(all(feature = "unstable-streams", feature = "attributes")))]
719732
/// # fn main() {}
720733
/// ```
721-
///
722-
/// **This API is marked as unstable** and is only available when the
723-
/// `unstable-streams` crate feature is enabled. This comes with no
724-
/// stability guarantees, and could be changed or removed at any time.
725734
#[cfg(feature = "unstable-streams")]
726735
pub fn into_stream_v2<'p>(
727736
gen: &'p PyAny,

src/generic.rs

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,10 @@ where
11191119

11201120
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>unstable-streams</code></span> Convert an async generator into a stream
11211121
///
1122+
/// **This API is marked as unstable** and is only available when the
1123+
/// `unstable-streams` crate feature is enabled. This comes with no
1124+
/// stability guarantees, and could be changed or removed at any time.
1125+
///
11221126
/// # Arguments
11231127
/// * `locals` - The current task locals
11241128
/// * `gen` - The Python async generator to be converted
@@ -1213,12 +1217,6 @@ where
12131217
/// Ok(())
12141218
/// # }
12151219
/// ```
1216-
///
1217-
/// # Availability
1218-
///
1219-
/// **This API is marked as unstable** and is only available when the
1220-
/// `unstable-streams` crate feature is enabled. This comes with no
1221-
/// stability guarantees, and could be changed or removed at any time.
12221220
#[cfg(feature = "unstable-streams")]
12231221
pub fn into_stream_with_locals_v1<'p, R>(
12241222
locals: TaskLocals,
@@ -1266,6 +1264,10 @@ where
12661264

12671265
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>unstable-streams</code></span> Convert an async generator into a stream
12681266
///
1267+
/// **This API is marked as unstable** and is only available when the
1268+
/// `unstable-streams` crate feature is enabled. This comes with no
1269+
/// stability guarantees, and could be changed or removed at any time.
1270+
///
12691271
/// # Arguments
12701272
/// * `gen` - The Python async generator to be converted
12711273
///
@@ -1356,12 +1358,6 @@ where
13561358
/// Ok(())
13571359
/// # }
13581360
/// ```
1359-
///
1360-
/// # Availability
1361-
///
1362-
/// **This API is marked as unstable** and is only available when the
1363-
/// `unstable-streams` crate feature is enabled. This comes with no
1364-
/// stability guarantees, and could be changed or removed at any time.
13651361
#[cfg(feature = "unstable-streams")]
13661362
pub fn into_stream_v1<'p, R>(
13671363
gen: &'p PyAny,
@@ -1471,6 +1467,10 @@ async def forward(gen, sender):
14711467

14721468
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>unstable-streams</code></span> Convert an async generator into a stream
14731469
///
1470+
/// **This API is marked as unstable** and is only available when the
1471+
/// `unstable-streams` crate feature is enabled. This comes with no
1472+
/// stability guarantees, and could be changed or removed at any time.
1473+
///
14741474
/// # Arguments
14751475
/// * `locals` - The current task locals
14761476
/// * `gen` - The Python async generator to be converted
@@ -1565,12 +1565,6 @@ async def forward(gen, sender):
15651565
/// Ok(())
15661566
/// # }
15671567
/// ```
1568-
///
1569-
/// # Availability
1570-
///
1571-
/// **This API is marked as unstable** and is only available when the
1572-
/// `unstable-streams` crate feature is enabled. This comes with no
1573-
/// stability guarantees, and could be changed or removed at any time.
15741568
#[cfg(feature = "unstable-streams")]
15751569
pub fn into_stream_with_locals_v2<'p, R>(
15761570
locals: TaskLocals,
@@ -1619,6 +1613,10 @@ where
16191613

16201614
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>unstable-streams</code></span> Convert an async generator into a stream
16211615
///
1616+
/// **This API is marked as unstable** and is only available when the
1617+
/// `unstable-streams` crate feature is enabled. This comes with no
1618+
/// stability guarantees, and could be changed or removed at any time.
1619+
///
16221620
/// # Arguments
16231621
/// * `gen` - The Python async generator to be converted
16241622
///
@@ -1709,12 +1707,6 @@ where
17091707
/// Ok(())
17101708
/// # }
17111709
/// ```
1712-
///
1713-
/// # Availability
1714-
///
1715-
/// **This API is marked as unstable** and is only available when the
1716-
/// `unstable-streams` crate feature is enabled. This comes with no
1717-
/// stability guarantees, and could be changed or removed at any time.
17181710
#[cfg(feature = "unstable-streams")]
17191711
pub fn into_stream_v2<'p, R>(
17201712
gen: &'p PyAny,

src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,9 @@ pub use inventory;
350350
#[cfg(feature = "testing")]
351351
pub mod testing;
352352

353-
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>async-std-runtime</code></span> PyO3 Asyncio functions specific to the async-std runtime
354353
#[cfg(feature = "async-std")]
355354
pub mod async_std;
356355

357-
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>tokio-runtime</code></span> PyO3 Asyncio functions specific to the tokio runtime
358356
#[cfg(feature = "tokio-runtime")]
359357
pub mod tokio;
360358

src/tokio.rs

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
//! <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>tokio-runtime</code></span> PyO3 Asyncio functions specific to the tokio runtime
2+
//!
3+
//! Items marked with
4+
//! <span
5+
//! class="module-item stab portability"
6+
//! style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"
7+
//! ><code>unstable-streams</code></span>
8+
//! are only available when the `unstable-streams` Cargo feature is enabled:
9+
//!
10+
//! ```toml
11+
//! [dependencies.pyo3-asyncio]
12+
//! version = "0.16"
13+
//! features = ["unstable-streams"]
14+
//! ```
15+
116
use std::{future::Future, pin::Pin, sync::Mutex};
217

318
use ::tokio::{
@@ -539,6 +554,10 @@ pub fn into_future(awaitable: &PyAny) -> PyResult<impl Future<Output = PyResult<
539554

540555
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>unstable-streams</code></span> Convert an async generator into a stream
541556
///
557+
/// **This API is marked as unstable** and is only available when the
558+
/// `unstable-streams` crate feature is enabled. This comes with no
559+
/// stability guarantees, and could be changed or removed at any time.
560+
///
542561
/// # Arguments
543562
/// * `locals` - The current task locals
544563
/// * `gen` - The Python async generator to be converted
@@ -586,12 +605,6 @@ pub fn into_future(awaitable: &PyAny) -> PyResult<impl Future<Output = PyResult<
586605
/// # #[cfg(not(all(feature = "unstable-streams", feature = "attributes")))]
587606
/// # fn main() {}
588607
/// ```
589-
///
590-
/// # Availability
591-
///
592-
/// **This API is marked as unstable** and is only available when the
593-
/// `unstable-streams` crate feature is enabled. This comes with no
594-
/// stability guarantees, and could be changed or removed at any time.
595608
#[cfg(feature = "unstable-streams")]
596609
pub fn into_stream_with_locals_v1<'p>(
597610
locals: TaskLocals,
@@ -602,6 +615,10 @@ pub fn into_stream_with_locals_v1<'p>(
602615

603616
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>unstable-streams</code></span> Convert an async generator into a stream
604617
///
618+
/// **This API is marked as unstable** and is only available when the
619+
/// `unstable-streams` crate feature is enabled. This comes with no
620+
/// stability guarantees, and could be changed or removed at any time.
621+
///
605622
/// # Arguments
606623
/// * `gen` - The Python async generator to be converted
607624
///
@@ -645,12 +662,6 @@ pub fn into_stream_with_locals_v1<'p>(
645662
/// # #[cfg(not(all(feature = "unstable-streams", feature = "attributes")))]
646663
/// # fn main() {}
647664
/// ```
648-
///
649-
/// # Availability
650-
///
651-
/// **This API is marked as unstable** and is only available when the
652-
/// `unstable-streams` crate feature is enabled. This comes with no
653-
/// stability guarantees, and could be changed or removed at any time.
654665
#[cfg(feature = "unstable-streams")]
655666
pub fn into_stream_v1<'p>(
656667
gen: &'p PyAny,
@@ -660,6 +671,10 @@ pub fn into_stream_v1<'p>(
660671

661672
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>unstable-streams</code></span> Convert an async generator into a stream
662673
///
674+
/// **This API is marked as unstable** and is only available when the
675+
/// `unstable-streams` crate feature is enabled. This comes with no
676+
/// stability guarantees, and could be changed or removed at any time.
677+
///
663678
/// # Arguments
664679
/// * `locals` - The current task locals
665680
/// * `gen` - The Python async generator to be converted
@@ -707,12 +722,6 @@ pub fn into_stream_v1<'p>(
707722
/// # #[cfg(not(all(feature = "unstable-streams", feature = "attributes")))]
708723
/// # fn main() {}
709724
/// ```
710-
///
711-
/// # Availability
712-
///
713-
/// **This API is marked as unstable** and is only available when the
714-
/// `unstable-streams` crate feature is enabled. This comes with no
715-
/// stability guarantees, and could be changed or removed at any time.
716725
#[cfg(feature = "unstable-streams")]
717726
pub fn into_stream_with_locals_v2<'p>(
718727
locals: TaskLocals,
@@ -723,6 +732,10 @@ pub fn into_stream_with_locals_v2<'p>(
723732

724733
/// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>unstable-streams</code></span> Convert an async generator into a stream
725734
///
735+
/// **This API is marked as unstable** and is only available when the
736+
/// `unstable-streams` crate feature is enabled. This comes with no
737+
/// stability guarantees, and could be changed or removed at any time.
738+
///
726739
/// # Arguments
727740
/// * `gen` - The Python async generator to be converted
728741
///
@@ -766,10 +779,6 @@ pub fn into_stream_with_locals_v2<'p>(
766779
/// # #[cfg(not(all(feature = "unstable-streams", feature = "attributes")))]
767780
/// # fn main() {}
768781
/// ```
769-
///
770-
/// **This API is marked as unstable** and is only available when the
771-
/// `unstable-streams` crate feature is enabled. This comes with no
772-
/// stability guarantees, and could be changed or removed at any time.
773782
#[cfg(feature = "unstable-streams")]
774783
pub fn into_stream_v2<'p>(
775784
gen: &'p PyAny,

0 commit comments

Comments
 (0)