mirror of
https://github.com/Noratrieb/ice-104649.git
synced 2026-01-14 20:45:01 +01:00
simplify
This commit is contained in:
parent
3c2b45e22f
commit
8fadb04d03
1 changed files with 10 additions and 2 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -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)) => {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue