use async_lock::Mutex;
use futures::channel::mpsc::Sender;
use futures::future::Future;
use std::sync::Arc;
use crate::runtime::Block;
use crate::runtime::FlowgraphMessage;
use crate::runtime::scheduler::Task;
#[cfg(not(target_arch = "wasm32"))]
pub trait Scheduler: Clone + Send + 'static {
fn run_flowgraph(
&self,
blocks: Vec<Arc<Mutex<dyn Block>>>,
main_channel: &Sender<FlowgraphMessage>,
);
fn spawn<T: Send + 'static>(&self, future: impl Future<Output = T> + Send + 'static)
-> Task<T>;
fn spawn_blocking<T: Send + 'static>(
&self,
future: impl Future<Output = T> + Send + 'static,
) -> Task<T>;
}
#[cfg(target_arch = "wasm32")]
pub trait Scheduler: Clone + Send + 'static {
fn run_flowgraph(
&self,
blocks: Vec<Arc<Mutex<dyn Block>>>,
main_channel: &Sender<FlowgraphMessage>,
);
fn spawn<T: Send + 'static>(&self, future: impl Future<Output = T> + 'static) -> Task<T>;
fn spawn_blocking<T: Send + 'static>(
&self,
future: impl Future<Output = T> + 'static,
) -> Task<T>;
}