dioxus/packages/core/examples/async.rs

37 lines
658 B
Rust
Raw Normal View History

use std::pin::Pin;
use dioxus_core::prelude::*;
use std::future::Future;
fn main() {}
const App: FC<()> = |cx| {
2021-07-09 15:54:07 +00:00
// create a new future
let mut fut = cx.use_hook(
|| {
//
2021-07-09 15:54:07 +00:00
async { loop {} }
// Box::pin(async { loop {} }) as Pin<Box<dyn Future<Output = ()>>>
},
|f| f,
|_| {},
);
2021-07-09 15:54:07 +00:00
// let g = unsafe { Pin::new_unchecked(fut) };
// cx.submit_task(fut);
2021-07-09 07:39:45 +00:00
todo!()
};
2021-07-13 20:48:11 +00:00
const Task: FC<()> = |cx| {
//
let s = cx.use_task(|| async { "hello world".to_string() });
todo!()
};
fn use_mut<P, T>(cx: Context<P>, f: impl FnOnce() -> T) -> &mut T {
todo!()
}