use crate::ScopeId;
use slab::Slab;
mod suspense;
mod task;
mod wait;
pub use suspense::*;
pub use task::*;
#[derive(Debug)]
pub(crate) enum SchedulerMsg {
Immediate(ScopeId),
TaskNotified(TaskId),
SuspenseNotified(SuspenseId),
}
use std::{cell::RefCell, rc::Rc};
pub(crate) struct Scheduler {
pub sender: futures_channel::mpsc::UnboundedSender<SchedulerMsg>,
pub tasks: RefCell<Slab<LocalTask>>,
pub leaves: RefCell<Slab<SuspenseLeaf>>,
}
impl Scheduler {
pub fn new(sender: futures_channel::mpsc::UnboundedSender<SchedulerMsg>) -> Rc<Self> {
Rc::new(Scheduler {
sender,
tasks: RefCell::new(Slab::new()),
leaves: RefCell::new(Slab::new()),
})
}
}