Xuanwo commented on PR #6622: URL: https://github.com/apache/opendal/pull/6622#issuecomment-3402480100
Thank you @chitralverma for working on this! I didn’t take a close look at the changes to `pyo3`. What’s the current state of writing `async fn` directly? I recall their page at https://pyo3.rs/v0.26.0/async-await saying we can just use: ```rust use std::{thread, time::Duration}; use futures::channel::oneshot; use pyo3::prelude::*; #[pyfunction] #[pyo3(signature=(seconds, result=None))] async fn sleep(seconds: f64, result: Option<Py<PyAny>>) -> Option<Py<PyAny>> { let (tx, rx) = oneshot::channel(); thread::spawn(move || { thread::sleep(Duration::from_secs_f64(seconds)); tx.send(()).unwrap(); }); rx.await.unwrap(); result } ``` What are the limitations? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
