Created
May 18, 2016 09:50
-
-
Save tailhook/d6f9ed25fc1f4dd4af98c7eb1dddeaf7 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
pub struct Context<X, E>(pub X, pub E); | |
impl<T, E> ResultExt<T, E> for Result<T, E> { | |
fn context<X>(self, x: X) -> Result<T, Context<X, E>> { | |
self.map_err(|e| Context(x, e)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment