wip: rename fc to component

This commit is contained in:
Jonathan Kelley committed 2021-12-09 21:19:31 -05:00
1 parent 85ab8b91c6
commit 1e4a599d14
61 files changed
+524 -145

No files matched your search

+8 -3
View File
@@ -6,9 +6,9 @@ use std::{
rc::Rc,
};
pub fn use_coroutine<'a, F: Future<Output = ()> + 'a>(
pub fn use_coroutine<'a, F: Future<Output = ()> + 'static>(
cx: Context<'a>,
f: impl FnOnce() -> F + 'a,
mut f: impl FnMut() -> F + 'a,
) -> CoroutineHandle {
//
cx.use_hook(
@@ -62,7 +62,7 @@ pub struct CoroutineHandle<'a> {
impl<'a> CoroutineHandle<'a> {
pub fn start(&self) {
if self.inner.running.get() {
if self.is_running() {
return;
}
if let Some(submit) = self.inner.submit.borrow_mut().take() {
@@ -71,5 +71,10 @@ impl<'a> CoroutineHandle<'a> {
self.cx.push_task(|| fut.as_mut().unwrap().as_mut());
}
}
pub fn is_running(&self) -> bool {
self.inner.running.get()
}
pub fn resume(&self) {}
}