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