Skip to content

Instantly share code, notes, and snippets.

@Kroisse
Last active March 20, 2018 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kroisse/e57d457e6c3c641f38df683e83c4f5d0 to your computer and use it in GitHub Desktop.
Save Kroisse/e57d457e6c3c641f38df683e83c4f5d0 to your computer and use it in GitHub Desktop.
fn eternal_pain<'a>(
&self,
handle: &'a Handle,
code: &str,
redirect_uri: Option<&str>,
) -> impl Future<Item=Output, Error=failure::Error> + 'a {
future::result::<_, Error>(
self.build_request_uri(code, redirect_uri)
).and_then(move |uri| {
Client::new(&handle).get(uri).map_err(From::from)
}).and_then(|res| {
res.body().concat2().map_err(From::from)
}).and_then(|body| {
serde_json::from_slice(&body).map_err(From::from)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment