@@ -13,7 +13,7 @@ use syn::spanned::Spanned;
1313/// # Examples
1414///
1515/// ```ignore
16- /// #[pyo3_asyncio ::async_std::main]
16+ /// #[pyo3_asyncio_0_21 ::async_std::main]
1717/// async fn main() -> PyResult<()> {
1818/// Ok(())
1919/// }
@@ -52,7 +52,7 @@ pub fn async_std_main(_attr: TokenStream, item: TokenStream) -> TokenStream {
5252 pyo3:: prepare_freethreaded_python( ) ;
5353
5454 pyo3:: Python :: with_gil( |py| {
55- pyo3_asyncio :: async_std:: run( py, main( ) )
55+ pyo3_asyncio_0_21 :: async_std:: run( py, main( ) )
5656 . map_err( |e| {
5757 e. print_and_set_sys_last_vars( py) ;
5858 } )
@@ -74,23 +74,23 @@ pub fn async_std_main(_attr: TokenStream, item: TokenStream) -> TokenStream {
7474///
7575/// Default configuration:
7676/// ```ignore
77- /// #[pyo3_asyncio ::tokio::main]
77+ /// #[pyo3_asyncio_0_21 ::tokio::main]
7878/// async fn main() -> PyResult<()> {
7979/// Ok(())
8080/// }
8181/// ```
8282///
8383/// Current-thread scheduler:
8484/// ```ignore
85- /// #[pyo3_asyncio ::tokio::main(flavor = "current_thread")]
85+ /// #[pyo3_asyncio_0_21 ::tokio::main(flavor = "current_thread")]
8686/// async fn main() -> PyResult<()> {
8787/// Ok(())
8888/// }
8989/// ```
9090///
9191/// Multi-thread scheduler with custom worker thread count:
9292/// ```ignore
93- /// #[pyo3_asyncio ::tokio::main(flavor = "multi_thread", worker_threads = 10)]
93+ /// #[pyo3_asyncio_0_21 ::tokio::main(flavor = "multi_thread", worker_threads = 10)]
9494/// async fn main() -> PyResult<()> {
9595/// Ok(())
9696/// }
@@ -114,21 +114,21 @@ pub fn tokio_main(args: TokenStream, item: TokenStream) -> TokenStream {
114114/// use pyo3::prelude::*;
115115///
116116/// // async test function
117- /// #[pyo3_asyncio ::async_std::test]
117+ /// #[pyo3_asyncio_0_21 ::async_std::test]
118118/// async fn test_async_sleep() -> PyResult<()> {
119119/// async_std::task::sleep(Duration::from_secs(1)).await;
120120/// Ok(())
121121/// }
122122///
123123/// // blocking test function
124- /// #[pyo3_asyncio ::async_std::test]
124+ /// #[pyo3_asyncio_0_21 ::async_std::test]
125125/// fn test_blocking_sleep() -> PyResult<()> {
126126/// thread::sleep(Duration::from_secs(1));
127127/// Ok(())
128128/// }
129129///
130130/// // blocking test functions can optionally accept an event_loop parameter
131- /// #[pyo3_asyncio ::async_std::test]
131+ /// #[pyo3_asyncio_0_21 ::async_std::test]
132132/// fn test_blocking_sleep_with_event_loop(event_loop: PyObject) -> PyResult<()> {
133133/// thread::sleep(Duration::from_secs(1));
134134/// Ok(())
@@ -148,16 +148,16 @@ pub fn async_std_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
148148 // Optionally pass an event_loop parameter to blocking tasks
149149 let task = if sig. inputs . is_empty ( ) {
150150 quote ! {
151- Box :: pin( pyo3_asyncio :: async_std:: re_exports:: spawn_blocking( move || {
151+ Box :: pin( pyo3_asyncio_0_21 :: async_std:: re_exports:: spawn_blocking( move || {
152152 #name( )
153153 } ) )
154154 }
155155 } else {
156156 quote ! {
157157 let event_loop = Python :: with_gil( |py| {
158- pyo3_asyncio :: async_std:: get_current_loop( py) . unwrap( ) . into( )
158+ pyo3_asyncio_0_21 :: async_std:: get_current_loop( py) . unwrap( ) . into( )
159159 } ) ;
160- Box :: pin( pyo3_asyncio :: async_std:: re_exports:: spawn_blocking( move || {
160+ Box :: pin( pyo3_asyncio_0_21 :: async_std:: re_exports:: spawn_blocking( move || {
161161 #name( event_loop)
162162 } ) )
163163 }
@@ -187,8 +187,8 @@ pub fn async_std_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
187187 let result = quote ! {
188188 #fn_impl
189189
190- pyo3_asyncio :: inventory:: submit! {
191- pyo3_asyncio :: testing:: Test {
190+ pyo3_asyncio_0_21 :: inventory:: submit! {
191+ pyo3_asyncio_0_21 :: testing:: Test {
192192 name: concat!( std:: module_path!( ) , "::" , stringify!( #name) ) ,
193193 test_fn: & #name
194194 }
@@ -211,21 +211,21 @@ pub fn async_std_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
211211/// use pyo3::prelude::*;
212212///
213213/// // async test function
214- /// #[pyo3_asyncio ::tokio::test]
214+ /// #[pyo3_asyncio_0_21 ::tokio::test]
215215/// async fn test_async_sleep() -> PyResult<()> {
216216/// tokio::time::sleep(Duration::from_secs(1)).await;
217217/// Ok(())
218218/// }
219219///
220220/// // blocking test function
221- /// #[pyo3_asyncio ::tokio::test]
221+ /// #[pyo3_asyncio_0_21 ::tokio::test]
222222/// fn test_blocking_sleep() -> PyResult<()> {
223223/// thread::sleep(Duration::from_secs(1));
224224/// Ok(())
225225/// }
226226///
227227/// // blocking test functions can optionally accept an event_loop parameter
228- /// #[pyo3_asyncio ::tokio::test]
228+ /// #[pyo3_asyncio_0_21 ::tokio::test]
229229/// fn test_blocking_sleep_with_event_loop(event_loop: PyObject) -> PyResult<()> {
230230/// thread::sleep(Duration::from_secs(1));
231231/// Ok(())
@@ -246,7 +246,7 @@ pub fn tokio_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
246246 let task = if sig. inputs . is_empty ( ) {
247247 quote ! {
248248 Box :: pin( async move {
249- match pyo3_asyncio :: tokio:: get_runtime( ) . spawn_blocking( move || #name( ) ) . await {
249+ match pyo3_asyncio_0_21 :: tokio:: get_runtime( ) . spawn_blocking( move || #name( ) ) . await {
250250 Ok ( result) => result,
251251 Err ( e) => {
252252 assert!( e. is_panic( ) ) ;
@@ -258,18 +258,18 @@ pub fn tokio_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
258258 } else {
259259 "unknown error" . into( )
260260 } ;
261- Err ( pyo3_asyncio :: err:: RustPanic :: new_err( format!( "rust future panicked: {}" , panic_message) ) )
261+ Err ( pyo3_asyncio_0_21 :: err:: RustPanic :: new_err( format!( "rust future panicked: {}" , panic_message) ) )
262262 }
263263 }
264264 } )
265265 }
266266 } else {
267267 quote ! {
268268 let event_loop = Python :: with_gil( |py| {
269- pyo3_asyncio :: tokio:: get_current_loop( py) . unwrap( ) . into( )
269+ pyo3_asyncio_0_21 :: tokio:: get_current_loop( py) . unwrap( ) . into( )
270270 } ) ;
271271 Box :: pin( async move {
272- match pyo3_asyncio :: tokio:: get_runtime( ) . spawn_blocking( move || #name( event_loop) ) . await {
272+ match pyo3_asyncio_0_21 :: tokio:: get_runtime( ) . spawn_blocking( move || #name( event_loop) ) . await {
273273 Ok ( result) => result,
274274 Err ( e) => {
275275 assert!( e. is_panic( ) ) ;
@@ -281,7 +281,7 @@ pub fn tokio_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
281281 } else {
282282 "unknown error" . into( )
283283 } ;
284- Err ( pyo3_asyncio :: err:: RustPanic :: new_err( format!( "rust future panicked: {}" , panic_message) ) )
284+ Err ( pyo3_asyncio_0_21 :: err:: RustPanic :: new_err( format!( "rust future panicked: {}" , panic_message) ) )
285285 }
286286 }
287287 } )
@@ -312,8 +312,8 @@ pub fn tokio_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
312312 let result = quote ! {
313313 #fn_impl
314314
315- pyo3_asyncio :: inventory:: submit! {
316- pyo3_asyncio :: testing:: Test {
315+ pyo3_asyncio_0_21 :: inventory:: submit! {
316+ pyo3_asyncio_0_21 :: testing:: Test {
317317 name: concat!( std:: module_path!( ) , "::" , stringify!( #name) ) ,
318318 test_fn: & #name
319319 }
0 commit comments