use core::future::Future;
use crate::{ExecutorResult, Spawn};
pub trait JoinFanInRuntime: Spawn {
type JoinQueue<T: Send + 'static>: JoinQueue<T>;
fn create_join_queue<T: Send + 'static>(&self) -> ExecutorResult<Self::JoinQueue<T>>;
}
pub trait JoinQueue<T: Send + 'static> {
type Sender: JoinSender<T> + Clone + Send + 'static;
type Receiver: JoinReceiver<T> + Send + 'static;
fn split(self) -> (Self::Sender, Self::Receiver);
}
pub trait JoinSender<T: Send + 'static> {
fn send(&self, item: T) -> impl Future<Output = ExecutorResult<()>> + Send + '_;
}
pub trait JoinReceiver<T: Send + 'static> {
fn recv(&mut self) -> impl Future<Output = ExecutorResult<T>> + Send + '_;
}