mirror of
https://github.com/Noratrieb/ice-104649.git
synced 2026-01-14 20:45:01 +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 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() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue