This commit is contained in:
nora 2022-11-20 22:23:39 +01:00
parent 3c2b45e22f
commit 8fadb04d03
No known key found for this signature in database

View file

@ -11,7 +11,7 @@ impl<T> Project for Wrap<T> {
pub trait Stream { pub trait Stream {
type Item; type Item;
fn get_projected<Fut, F>(self, f: F) fn get_projected<Fut, F>(self, f: F) -> Self::Item
where where
F: FnMut(Self::Item) -> Fut, F: FnMut(Self::Item) -> Fut,
Self: Sized, Self: Sized,
@ -42,11 +42,19 @@ where
} }
fn main() { 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 { proj.get_projected(|b| async {
// The type of `b` is `Result<Result<(), _1>, ()> where _1 is unknown.
match b { match b {
Ok(Ok(url)) => {} Ok(Ok(url)) => {}
Err(e) => {} Err(e) => {}
// `e` has type _1.
Ok(Err(e)) => {} Ok(Err(e)) => {}
} }
}); });