lol no futures

This commit is contained in:
nora 2022-11-20 22:08:47 +01:00
parent 51388a90af
commit 0ec210b468
No known key found for this signature in database

View file

@ -1,18 +1,13 @@
use fut::Stream;
use std::{
future::Future,
pin::Pin,
task::{Context, Poll},
};
trait Project {
type Assoc;
}
pub struct FutResult<T>(T);
impl<T> Future for FutResult<T> {
type Output = Result<T, ()>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
loop {}
}
impl<T> Project for FutResult<T> {
type Assoc = Result<T, ()>;
}
mod fut {
@ -22,6 +17,8 @@ mod fut {
task::{Context, Poll},
};
use crate::Project;
pub trait Stream {
type Item;
@ -62,9 +59,9 @@ mod fut {
impl<F> Stream for Map<F>
where
F: FnOnce1<String>,
F::Output: Future,
F::Output: Project,
{
type Item = <F::Output as Future>::Output;
type Item = <F::Output as Project>::Assoc;
}
pub struct ForEach<St, Fut, F> {
@ -72,19 +69,6 @@ mod fut {
f: F,
future: Option<Fut>,
}
impl<St, Fut, F> Future for ForEach<St, Fut, F>
where
St: Stream,
F: FnMut(St::Item) -> Fut,
Fut: Future<Output = ()>,
{
type Output = ();
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
loop {}
}
}
}
fn main() {