use std::future::Future;
use crate::OptionalSend;
use crate::OptionalSync;
pub trait Oneshot {
type Sender<T: OptionalSend>: OneshotSender<T>;
type Receiver<T: OptionalSend>: OptionalSend
+ OptionalSync
+ Future<Output = Result<T, Self::ReceiverError>>
+ Unpin;
type ReceiverError: std::error::Error + OptionalSend;
#[track_caller]
fn channel<T>() -> (Self::Sender<T>, Self::Receiver<T>)
where T: OptionalSend;
}
pub trait OneshotSender<T>: OptionalSend + OptionalSync + Sized
where T: OptionalSend
{
#[track_caller]
fn send(self, t: T) -> Result<(), T>;
}