From a226e71cdec3d7f3fff270e0abc5b0249d8759f6 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sun, 20 Nov 2022 22:06:34 +0100 Subject: [PATCH] lol no futures --- src/main.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index f39b5f0..31d1348 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,15 +43,14 @@ mod fut { } } - pub struct Empty; - - impl Stream for Empty { - type Item = String; + pub fn map(f: F) -> Map + where + F: FnMut(String) -> T, + { + loop {} } - pub struct Map { - f: F, - } + pub struct Map(F); pub trait FnOnce1 { type Output; @@ -97,7 +96,7 @@ mod fut { } fn main() { - let bodies = fut::Empty.map(|url| FutResult(Result::Ok(url))); + let bodies = fut::map(|url| FutResult(Result::Ok(url))); bodies.for_each(|b| async { match b {