From 79e9aa8d4f5edad0df5f2aea0f394f648ca8eaa9 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sun, 20 Nov 2022 20:32:01 +0100 Subject: [PATCH] simplify --- src/main.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0a58701..89e977f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,37 +1,37 @@ use std::marker::PhantomData; -use futures::{stream, StreamExt, Future}; +use futures::{stream, Future, StreamExt}; pub struct JoinHandle { - raw: Option<()>, - id: u64, _p: PhantomData, } impl Future for JoinHandle { type Output = Result; - fn poll(self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>) -> std::task::Poll { + fn poll( + self: std::pin::Pin<&mut Self>, + cx: &mut std::task::Context<'_>, + ) -> std::task::Poll { loop {} } } pub fn spawn(future: T) -> JoinHandle where - T: Future + Send + 'static, - T::Output: Send + 'static, + T: Future, { - loop {} + loop {} } fn main() { let bodies = stream::iter([]) - .map(|url: String| spawn(async move { Result::Ok((url, "A".to_owned())) })) + .map(|url: String| spawn(async { Result::Ok(url) })) .buffer_unordered(0); bodies.for_each(|b| async { match b { - Ok(Ok((url, b))) => {} + Ok(Ok(url)) => {} Err(e) => {} Ok(Err(e)) => {} }