1use core::future::Future;
2
3use crate::{ExecutorResult, Spawn};
4
5pub trait JoinFanInRuntime: Spawn {
10 type JoinQueue<T: Send + 'static>: JoinQueue<T>;
11
12 fn create_join_queue<T: Send + 'static>(&self) -> ExecutorResult<Self::JoinQueue<T>>;
13}
14
15pub trait JoinQueue<T: Send + 'static> {
17 type Sender: JoinSender<T> + Clone + Send + 'static;
18 type Receiver: JoinReceiver<T> + Send + 'static;
19
20 fn split(self) -> (Self::Sender, Self::Receiver);
21}
22
23pub trait JoinSender<T: Send + 'static> {
28 fn send(&self, item: T) -> impl Future<Output = ExecutorResult<()>> + Send + '_;
29}
30
31pub trait JoinReceiver<T: Send + 'static> {
35 fn recv(&mut self) -> impl Future<Output = ExecutorResult<T>> + Send + '_;
36}