mirror of
https://github.com/Noratrieb/ice-104649.git
synced 2026-01-16 13:25:03 +01:00
lol no futures
This commit is contained in:
parent
a48725941e
commit
5c0db2ec87
1 changed files with 3 additions and 27 deletions
30
src/main.rs
30
src/main.rs
|
|
@ -41,14 +41,6 @@ mod fut {
|
||||||
{
|
{
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn buffer_unordered(self) -> BufferUnordered<Self>
|
|
||||||
where
|
|
||||||
Self::Item: Future,
|
|
||||||
Self: Sized,
|
|
||||||
{
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Empty;
|
pub struct Empty;
|
||||||
|
|
@ -81,8 +73,9 @@ mod fut {
|
||||||
where
|
where
|
||||||
St: Stream,
|
St: Stream,
|
||||||
F: FnOnce1<St::Item>,
|
F: FnOnce1<St::Item>,
|
||||||
|
F::Output: Future,
|
||||||
{
|
{
|
||||||
type Item = F::Output;
|
type Item = <F::Output as Future>::Output;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ForEach<St, Fut, F> {
|
pub struct ForEach<St, Fut, F> {
|
||||||
|
|
@ -103,27 +96,10 @@ mod fut {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct BufferUnordered<St>
|
|
||||||
where
|
|
||||||
St: Stream,
|
|
||||||
{
|
|
||||||
stream: St,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<St> Stream for BufferUnordered<St>
|
|
||||||
where
|
|
||||||
St: Stream,
|
|
||||||
St::Item: Future,
|
|
||||||
{
|
|
||||||
type Item = <St::Item as Future>::Output;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let bodies = fut::Empty
|
let bodies = fut::Empty.map(|url| FutResult(Result::Ok(url)));
|
||||||
.map(|url| FutResult(Result::Ok(url)))
|
|
||||||
.buffer_unordered();
|
|
||||||
|
|
||||||
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