From 8fadb04d0355044d841d36ad8e7e98ea4eaf94ab Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sun, 20 Nov 2022 22:23:39 +0100 Subject: [PATCH] simplify --- src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index e40e5a3..8b82f07 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,7 @@ impl Project for Wrap { pub trait Stream { type Item; - fn get_projected(self, f: F) + fn get_projected(self, f: F) -> Self::Item where F: FnMut(Self::Item) -> Fut, Self: Sized, @@ -42,11 +42,19 @@ where } fn main() { - let proj = ProjectFnOutput(|| Wrap(Result::Ok(()))); + let proj = ProjectFnOutput(|| { + Wrap( + // This is `Result<(), _1>` but since no type annotations are provided the tpye of _1 is unknown. + Ok(()), + ) + }); + proj.get_projected(|b| async { + // The type of `b` is `Result, ()> where _1 is unknown. match b { Ok(Ok(url)) => {} Err(e) => {} + // `e` has type _1. Ok(Err(e)) => {} } });