@@ -13,7 +13,7 @@ use syn::spanned::Spanned;
13
13
/// # Examples
14
14
///
15
15
/// ```ignore
16
- /// #[pyo3_asyncio_0_21 ::async_std::main]
16
+ /// #[pyo3_async_runtimes ::async_std::main]
17
17
/// async fn main() -> PyResult<()> {
18
18
/// Ok(())
19
19
/// }
@@ -52,7 +52,7 @@ pub fn async_std_main(_attr: TokenStream, item: TokenStream) -> TokenStream {
52
52
pyo3:: prepare_freethreaded_python( ) ;
53
53
54
54
pyo3:: Python :: with_gil( |py| {
55
- pyo3_asyncio_0_21 :: async_std:: run( py, main( ) )
55
+ pyo3_async_runtimes :: async_std:: run( py, main( ) )
56
56
. map_err( |e| {
57
57
e. print_and_set_sys_last_vars( py) ;
58
58
} )
@@ -74,23 +74,23 @@ pub fn async_std_main(_attr: TokenStream, item: TokenStream) -> TokenStream {
74
74
///
75
75
/// Default configuration:
76
76
/// ```ignore
77
- /// #[pyo3_asyncio_0_21 ::tokio::main]
77
+ /// #[pyo3_async_runtimes ::tokio::main]
78
78
/// async fn main() -> PyResult<()> {
79
79
/// Ok(())
80
80
/// }
81
81
/// ```
82
82
///
83
83
/// Current-thread scheduler:
84
84
/// ```ignore
85
- /// #[pyo3_asyncio_0_21 ::tokio::main(flavor = "current_thread")]
85
+ /// #[pyo3_async_runtimes ::tokio::main(flavor = "current_thread")]
86
86
/// async fn main() -> PyResult<()> {
87
87
/// Ok(())
88
88
/// }
89
89
/// ```
90
90
///
91
91
/// Multi-thread scheduler with custom worker thread count:
92
92
/// ```ignore
93
- /// #[pyo3_asyncio_0_21 ::tokio::main(flavor = "multi_thread", worker_threads = 10)]
93
+ /// #[pyo3_async_runtimes ::tokio::main(flavor = "multi_thread", worker_threads = 10)]
94
94
/// async fn main() -> PyResult<()> {
95
95
/// Ok(())
96
96
/// }
@@ -114,21 +114,21 @@ pub fn tokio_main(args: TokenStream, item: TokenStream) -> TokenStream {
114
114
/// use pyo3::prelude::*;
115
115
///
116
116
/// // async test function
117
- /// #[pyo3_asyncio_0_21 ::async_std::test]
117
+ /// #[pyo3_async_runtimes ::async_std::test]
118
118
/// async fn test_async_sleep() -> PyResult<()> {
119
119
/// async_std::task::sleep(Duration::from_secs(1)).await;
120
120
/// Ok(())
121
121
/// }
122
122
///
123
123
/// // blocking test function
124
- /// #[pyo3_asyncio_0_21 ::async_std::test]
124
+ /// #[pyo3_async_runtimes ::async_std::test]
125
125
/// fn test_blocking_sleep() -> PyResult<()> {
126
126
/// thread::sleep(Duration::from_secs(1));
127
127
/// Ok(())
128
128
/// }
129
129
///
130
130
/// // blocking test functions can optionally accept an event_loop parameter
131
- /// #[pyo3_asyncio_0_21 ::async_std::test]
131
+ /// #[pyo3_async_runtimes ::async_std::test]
132
132
/// fn test_blocking_sleep_with_event_loop(event_loop: PyObject) -> PyResult<()> {
133
133
/// thread::sleep(Duration::from_secs(1));
134
134
/// Ok(())
@@ -148,16 +148,16 @@ pub fn async_std_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
148
148
// Optionally pass an event_loop parameter to blocking tasks
149
149
let task = if sig. inputs . is_empty ( ) {
150
150
quote ! {
151
- Box :: pin( pyo3_asyncio_0_21 :: async_std:: re_exports:: spawn_blocking( move || {
151
+ Box :: pin( pyo3_async_runtimes :: async_std:: re_exports:: spawn_blocking( move || {
152
152
#name( )
153
153
} ) )
154
154
}
155
155
} else {
156
156
quote ! {
157
157
let event_loop = Python :: with_gil( |py| {
158
- pyo3_asyncio_0_21 :: async_std:: get_current_loop( py) . unwrap( ) . into( )
158
+ pyo3_async_runtimes :: async_std:: get_current_loop( py) . unwrap( ) . into( )
159
159
} ) ;
160
- Box :: pin( pyo3_asyncio_0_21 :: async_std:: re_exports:: spawn_blocking( move || {
160
+ Box :: pin( pyo3_async_runtimes :: async_std:: re_exports:: spawn_blocking( move || {
161
161
#name( event_loop)
162
162
} ) )
163
163
}
@@ -187,8 +187,8 @@ pub fn async_std_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
187
187
let result = quote ! {
188
188
#fn_impl
189
189
190
- pyo3_asyncio_0_21 :: inventory:: submit! {
191
- pyo3_asyncio_0_21 :: testing:: Test {
190
+ pyo3_async_runtimes :: inventory:: submit! {
191
+ pyo3_async_runtimes :: testing:: Test {
192
192
name: concat!( std:: module_path!( ) , "::" , stringify!( #name) ) ,
193
193
test_fn: & #name
194
194
}
@@ -211,21 +211,21 @@ pub fn async_std_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
211
211
/// use pyo3::prelude::*;
212
212
///
213
213
/// // async test function
214
- /// #[pyo3_asyncio_0_21 ::tokio::test]
214
+ /// #[pyo3_async_runtimes ::tokio::test]
215
215
/// async fn test_async_sleep() -> PyResult<()> {
216
216
/// tokio::time::sleep(Duration::from_secs(1)).await;
217
217
/// Ok(())
218
218
/// }
219
219
///
220
220
/// // blocking test function
221
- /// #[pyo3_asyncio_0_21 ::tokio::test]
221
+ /// #[pyo3_async_runtimes ::tokio::test]
222
222
/// fn test_blocking_sleep() -> PyResult<()> {
223
223
/// thread::sleep(Duration::from_secs(1));
224
224
/// Ok(())
225
225
/// }
226
226
///
227
227
/// // blocking test functions can optionally accept an event_loop parameter
228
- /// #[pyo3_asyncio_0_21 ::tokio::test]
228
+ /// #[pyo3_async_runtimes ::tokio::test]
229
229
/// fn test_blocking_sleep_with_event_loop(event_loop: PyObject) -> PyResult<()> {
230
230
/// thread::sleep(Duration::from_secs(1));
231
231
/// Ok(())
@@ -246,7 +246,7 @@ pub fn tokio_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
246
246
let task = if sig. inputs . is_empty ( ) {
247
247
quote ! {
248
248
Box :: pin( async move {
249
- match pyo3_asyncio_0_21 :: tokio:: get_runtime( ) . spawn_blocking( move || #name( ) ) . await {
249
+ match pyo3_async_runtimes :: tokio:: get_runtime( ) . spawn_blocking( move || #name( ) ) . await {
250
250
Ok ( result) => result,
251
251
Err ( e) => {
252
252
assert!( e. is_panic( ) ) ;
@@ -258,18 +258,18 @@ pub fn tokio_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
258
258
} else {
259
259
"unknown error" . into( )
260
260
} ;
261
- Err ( pyo3_asyncio_0_21 :: err:: RustPanic :: new_err( format!( "rust future panicked: {}" , panic_message) ) )
261
+ Err ( pyo3_async_runtimes :: err:: RustPanic :: new_err( format!( "rust future panicked: {}" , panic_message) ) )
262
262
}
263
263
}
264
264
} )
265
265
}
266
266
} else {
267
267
quote ! {
268
268
let event_loop = Python :: with_gil( |py| {
269
- pyo3_asyncio_0_21 :: tokio:: get_current_loop( py) . unwrap( ) . into( )
269
+ pyo3_async_runtimes :: tokio:: get_current_loop( py) . unwrap( ) . into( )
270
270
} ) ;
271
271
Box :: pin( async move {
272
- match pyo3_asyncio_0_21 :: tokio:: get_runtime( ) . spawn_blocking( move || #name( event_loop) ) . await {
272
+ match pyo3_async_runtimes :: tokio:: get_runtime( ) . spawn_blocking( move || #name( event_loop) ) . await {
273
273
Ok ( result) => result,
274
274
Err ( e) => {
275
275
assert!( e. is_panic( ) ) ;
@@ -281,7 +281,7 @@ pub fn tokio_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
281
281
} else {
282
282
"unknown error" . into( )
283
283
} ;
284
- Err ( pyo3_asyncio_0_21 :: err:: RustPanic :: new_err( format!( "rust future panicked: {}" , panic_message) ) )
284
+ Err ( pyo3_async_runtimes :: err:: RustPanic :: new_err( format!( "rust future panicked: {}" , panic_message) ) )
285
285
}
286
286
}
287
287
} )
@@ -312,8 +312,8 @@ pub fn tokio_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
312
312
let result = quote ! {
313
313
#fn_impl
314
314
315
- pyo3_asyncio_0_21 :: inventory:: submit! {
316
- pyo3_asyncio_0_21 :: testing:: Test {
315
+ pyo3_async_runtimes :: inventory:: submit! {
316
+ pyo3_async_runtimes :: testing:: Test {
317
317
name: concat!( std:: module_path!( ) , "::" , stringify!( #name) ) ,
318
318
test_fn: & #name
319
319
}
0 commit comments