55//! class="module-item stab portability"
66//! style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"
77//! ><code>unstable-streams</code></span>
8- //! are only available when the `unstable-streams` Cargo feature is enabled:
8+ //! > are only available when the `unstable-streams` Cargo feature is enabled:
99//!
1010//! ```toml
1111//! [dependencies.pyo3-asyncio-0-21]
@@ -478,13 +478,13 @@ where
478478/// via [`into_future`] (new behaviour in `v0.15`).
479479///
480480/// > Although `contextvars` are preserved for async Python functions, synchronous functions will
481- /// unfortunately fail to resolve them when called within the Rust future. This is because the
482- /// function is being called from a Rust thread, not inside an actual Python coroutine context.
481+ /// > unfortunately fail to resolve them when called within the Rust future. This is because the
482+ /// > function is being called from a Rust thread, not inside an actual Python coroutine context.
483483/// >
484484/// > As a workaround, you can get the `contextvars` from the current task locals using
485- /// [`get_current_locals`] and [`TaskLocals::context`](`crate::TaskLocals::context`), then wrap your
486- /// synchronous function in a call to `contextvars.Context.run`. This will set the context, call the
487- /// synchronous function, and restore the previous context when it returns or raises an exception.
485+ /// > [`get_current_locals`] and [`TaskLocals::context`](`crate::TaskLocals::context`), then wrap your
486+ /// > synchronous function in a call to `contextvars.Context.run`. This will set the context, call the
487+ /// > synchronous function, and restore the previous context when it returns or raises an exception.
488488///
489489/// # Arguments
490490/// * `py` - PyO3 GIL guard
@@ -655,7 +655,7 @@ fn get_panic_message(any: &dyn std::any::Any) -> &str {
655655 if let Some ( str_slice) = any. downcast_ref :: < & str > ( ) {
656656 str_slice
657657 } else if let Some ( string) = any. downcast_ref :: < String > ( ) {
658- string
658+ string. as_str ( )
659659 } else {
660660 "unknown error"
661661 }
@@ -751,13 +751,13 @@ impl PyDoneCallback {
751751/// via [`into_future`] (new behaviour in `v0.15`).
752752///
753753/// > Although `contextvars` are preserved for async Python functions, synchronous functions will
754- /// unfortunately fail to resolve them when called within the Rust future. This is because the
755- /// function is being called from a Rust thread, not inside an actual Python coroutine context.
754+ /// > unfortunately fail to resolve them when called within the Rust future. This is because the
755+ /// > function is being called from a Rust thread, not inside an actual Python coroutine context.
756756/// >
757757/// > As a workaround, you can get the `contextvars` from the current task locals using
758- /// [`get_current_locals`] and [`TaskLocals::context`](`crate::TaskLocals::context`), then wrap your
759- /// synchronous function in a call to `contextvars.Context.run`. This will set the context, call the
760- /// synchronous function, and restore the previous context when it returns or raises an exception.
758+ /// > [`get_current_locals`] and [`TaskLocals::context`](`crate::TaskLocals::context`), then wrap your
759+ /// > synchronous function in a call to `contextvars.Context.run`. This will set the context, call the
760+ /// > synchronous function, and restore the previous context when it returns or raises an exception.
761761///
762762/// # Arguments
763763/// * `py` - The current PyO3 GIL guard
@@ -859,13 +859,13 @@ where
859859/// via [`into_future`] (new behaviour in `v0.15`).
860860///
861861/// > Although `contextvars` are preserved for async Python functions, synchronous functions will
862- /// unfortunately fail to resolve them when called within the Rust future. This is because the
863- /// function is being called from a Rust thread, not inside an actual Python coroutine context.
862+ /// > unfortunately fail to resolve them when called within the Rust future. This is because the
863+ /// > function is being called from a Rust thread, not inside an actual Python coroutine context.
864864/// >
865865/// > As a workaround, you can get the `contextvars` from the current task locals using
866- /// [`get_current_locals`] and [`TaskLocals::context`](`crate::TaskLocals::context`), then wrap your
867- /// synchronous function in a call to `contextvars.Context.run`. This will set the context, call the
868- /// synchronous function, and restore the previous context when it returns or raises an exception.
866+ /// > [`get_current_locals`] and [`TaskLocals::context`](`crate::TaskLocals::context`), then wrap your
867+ /// > synchronous function in a call to `contextvars.Context.run`. This will set the context, call the
868+ /// > synchronous function, and restore the previous context when it returns or raises an exception.
869869///
870870/// # Arguments
871871/// * `py` - PyO3 GIL guard
@@ -1065,13 +1065,13 @@ where
10651065/// via [`into_future`] (new behaviour in `v0.15`).
10661066///
10671067/// > Although `contextvars` are preserved for async Python functions, synchronous functions will
1068- /// unfortunately fail to resolve them when called within the Rust future. This is because the
1069- /// function is being called from a Rust thread, not inside an actual Python coroutine context.
1068+ /// > unfortunately fail to resolve them when called within the Rust future. This is because the
1069+ /// > function is being called from a Rust thread, not inside an actual Python coroutine context.
10701070/// >
10711071/// > As a workaround, you can get the `contextvars` from the current task locals using
1072- /// [`get_current_locals`] and [`TaskLocals::context`](`crate::TaskLocals::context`), then wrap your
1073- /// synchronous function in a call to `contextvars.Context.run`. This will set the context, call the
1074- /// synchronous function, and restore the previous context when it returns or raises an exception.
1072+ /// > [`get_current_locals`] and [`TaskLocals::context`](`crate::TaskLocals::context`), then wrap your
1073+ /// > synchronous function in a call to `contextvars.Context.run`. This will set the context, call the
1074+ /// > synchronous function, and restore the previous context when it returns or raises an exception.
10751075///
10761076/// # Arguments
10771077/// * `py` - The current PyO3 GIL guard
@@ -1446,11 +1446,14 @@ where
14461446 into_stream_with_locals_v1 :: < R > ( get_current_locals :: < R > ( gen. py ( ) ) ?, gen)
14471447}
14481448
1449+ #[ allow( dead_code) ]
14491450fn py_true ( ) -> PyObject {
14501451 static TRUE : OnceCell < PyObject > = OnceCell :: new ( ) ;
14511452 TRUE . get_or_init ( || Python :: with_gil ( |py| true . into_py ( py) ) )
14521453 . clone ( )
14531454}
1455+
1456+ #[ allow( dead_code) ]
14541457fn py_false ( ) -> PyObject {
14551458 static FALSE : OnceCell < PyObject > = OnceCell :: new ( ) ;
14561459 FALSE
@@ -1463,6 +1466,7 @@ trait Sender: Send + 'static {
14631466 fn close ( & mut self ) -> PyResult < ( ) > ;
14641467}
14651468
1469+ #[ allow( dead_code) ]
14661470struct GenericSender < R >
14671471where
14681472 R : Runtime ,
0 commit comments