async.rs 457 B

123456789101112131415161718192021222324
  1. use std::pin::Pin;
  2. use dioxus_core::prelude::*;
  3. use std::future::Future;
  4. fn main() {}
  5. const App: FC<()> = |cx| {
  6. // create a new future
  7. let mut fut = cx.use_hook(
  8. || {
  9. //
  10. async { loop {} }
  11. // Box::pin(async { loop {} }) as Pin<Box<dyn Future<Output = ()>>>
  12. },
  13. |f| f,
  14. |_| {},
  15. );
  16. // let g = unsafe { Pin::new_unchecked(fut) };
  17. // cx.submit_task(fut);
  18. todo!()
  19. };