use crate::*;
pub trait SomeStaticExecutor: 'static + Debug {
type ExecutorNotifier: ExecutorNotified;
fn spawn_static<F, Notifier: ObserverNotified<F::Output>>(
&mut self,
task: Task<F, Notifier>,
) -> impl Observer<Value = F::Output>
where
Self: Sized,
F: Future + 'static,
F::Output: 'static + Unpin;
fn spawn_static_async<F, Notifier: ObserverNotified<F::Output>>(
&mut self,
task: Task<F, Notifier>,
) -> impl Future<Output = impl Observer<Value = F::Output>>
where
Self: Sized,
F: Future + 'static,
F::Output: 'static + Unpin;
fn spawn_static_objsafe(&mut self, task: ObjSafeStaticTask) -> BoxedStaticObserver;
fn spawn_static_objsafe_async<'s>(
&'s mut self,
task: ObjSafeStaticTask,
) -> BoxedStaticObserverFuture<'s>;
fn clone_box(&self) -> Box<DynStaticExecutor>;
fn executor_notifier(&mut self) -> Option<Self::ExecutorNotifier>;
}
pub trait StaticBlockOn: SomeStaticExecutor {
fn block_on_static<F: Future>(&mut self, future: F) -> F::Output
where
F::Output: 'static;
}
pub trait StaticExecutorExt: SomeStaticExecutor + Clone {}
impl SomeStaticExecutor for Infallible {
type ExecutorNotifier = Infallible;
fn spawn_static<F, Notifier: ObserverNotified<F::Output>>(
&mut self,
_task: Task<F, Notifier>,
) -> impl Observer<Value = F::Output>
where
Self: Sized,
F: Future + 'static,
F::Output: 'static + Unpin,
{
#[allow(unreachable_code)]
{
unimplemented!() as TypedObserver<F::Output, Infallible>
}
}
fn spawn_static_async<F, Notifier: ObserverNotified<F::Output>>(
&mut self,
_task: Task<F, Notifier>,
) -> impl Future<Output = impl Observer<Value = F::Output>>
where
Self: Sized,
F: Future + 'static,
F::Output: 'static + Unpin,
{
#[allow(unreachable_code)]
#[allow(clippy::async_yields_async)]
{
async { todo!() as TypedObserver<F::Output, Infallible> }
}
}
fn spawn_static_objsafe(&mut self, _task: ObjSafeStaticTask) -> BoxedStaticObserver {
unimplemented!()
}
fn spawn_static_objsafe_async<'s>(
&'s mut self,
_task: ObjSafeStaticTask,
) -> BoxedStaticObserverFuture<'s> {
unimplemented!()
}
fn clone_box(&self) -> Box<DynStaticExecutor> {
unimplemented!()
}
fn executor_notifier(&mut self) -> Option<Self::ExecutorNotifier> {
unimplemented!()
}
}