2021-07-09 05:26:15 +00:00
|
|
|
use std::pin::Pin;
|
|
|
|
|
|
|
|
use dioxus_core::prelude::*;
|
2021-07-11 18:49:52 +00:00
|
|
|
use std::future::Future;
|
2021-07-09 05:26:15 +00:00
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
|
|
|
|
const App: FC<()> = |cx| {
|
2021-07-09 15:54:07 +00:00
|
|
|
// create a new future
|
2021-07-09 05:26:15 +00:00
|
|
|
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 = ()>>>
|
2021-07-09 05:26:15 +00:00
|
|
|
},
|
|
|
|
|f| f,
|
|
|
|
|_| {},
|
|
|
|
);
|
2021-07-09 15:54:07 +00:00
|
|
|
// let g = unsafe { Pin::new_unchecked(fut) };
|
2021-07-09 05:26:15 +00:00
|
|
|
|
2021-07-11 18:49:52 +00:00
|
|
|
// cx.submit_task(fut);
|
2021-07-09 07:39:45 +00:00
|
|
|
|
2021-07-09 05:26:15 +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!()
|
|
|
|
}
|