mirror of
https://github.com/Noratrieb/ice-104649.git
synced 2026-01-16 21:35:02 +01:00
lol no futures
This commit is contained in:
parent
592e86e3f3
commit
4433f6b891
1 changed files with 39 additions and 45 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -10,18 +10,14 @@ impl<T> Project for FutResult<T> {
|
||||||
type Assoc = Result<T, ()>;
|
type Assoc = Result<T, ()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
mod fut {
|
|
||||||
use std::future::Future;
|
|
||||||
|
|
||||||
use crate::Project;
|
use crate::Project;
|
||||||
|
|
||||||
pub trait Stream {
|
pub trait Stream {
|
||||||
type Item;
|
type Item;
|
||||||
|
|
||||||
fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F>
|
fn for_each<Fut, F>(self, f: F) -> ForEach<Self, F>
|
||||||
where
|
where
|
||||||
F: FnMut(Self::Item) -> Fut,
|
F: FnMut(Self::Item) -> Fut,
|
||||||
Fut: Future<Output = ()>,
|
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
loop {}
|
loop {}
|
||||||
|
|
@ -60,15 +56,13 @@ mod fut {
|
||||||
type Item = <F::Output as Project>::Assoc;
|
type Item = <F::Output as Project>::Assoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ForEach<St, Fut, F> {
|
pub struct ForEach<St, F> {
|
||||||
stream: St,
|
stream: St,
|
||||||
f: F,
|
f: F,
|
||||||
future: Fut,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let bodies = fut::map(|url| FutResult(Result::Ok(url)));
|
let bodies = map(|url| FutResult(Result::Ok(url)));
|
||||||
|
|
||||||
bodies.for_each(|b| async {
|
bodies.for_each(|b| async {
|
||||||
match b {
|
match b {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue