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
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 {}
|
||||
}
|
||||
|
||||
fn buffer_unordered(self) -> BufferUnordered<Self>
|
||||
where
|
||||
Self::Item: Future,
|
||||
Self: Sized,
|
||||
{
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Empty;
|
||||
|
|
@ -81,8 +73,9 @@ mod fut {
|
|||
where
|
||||
St: Stream,
|
||||
F: FnOnce1<St::Item>,
|
||||
F::Output: Future,
|
||||
{
|
||||
type Item = F::Output;
|
||||
type Item = <F::Output as Future>::Output;
|
||||
}
|
||||
|
||||
pub struct ForEach<St, Fut, F> {
|
||||
|
|
@ -103,27 +96,10 @@ mod fut {
|
|||
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() {
|
||||
let bodies = fut::Empty
|
||||
.map(|url| FutResult(Result::Ok(url)))
|
||||
.buffer_unordered();
|
||||
let bodies = fut::Empty.map(|url| FutResult(Result::Ok(url)));
|
||||
|
||||
bodies.for_each(|b| async {
|
||||
match b {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue