mirror of
https://github.com/Noratrieb/ice-104649.git
synced 2026-01-14 12:35:02 +01:00
lol no futures
This commit is contained in:
parent
51388a90af
commit
0ec210b468
1 changed files with 10 additions and 26 deletions
36
src/main.rs
36
src/main.rs
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue