-
-
Save nikomatsakis/58717b0588393ca14f2d6168e7c86188 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Result<T, E> { } | |
trait Future { | |
type Output; | |
} | |
trait FutureResult | |
where | |
Self: Future< | |
Output = Result< | |
<Self as FutureResult>::Item, | |
<Self as FutureResult>::Error | |
> | |
> | |
{ | |
type Item; | |
type Error; | |
} | |
impl<T, I, E> FutureResult for T | |
where T: Future<Output = Result<I, E>> | |
{ | |
type Item = I; | |
type Error = E; | |
} | |
struct u32 { } | |
struct Error { } | |
struct MyFuture1 { } | |
impl Future for MyFuture1 { | |
type Output = u32; | |
} | |
struct MyFuture2 { } | |
impl Future for MyFuture2 { | |
type Output = Result<u32, Error>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment