Skip to content
This repository has been archived by the owner on Mar 23, 2020. It is now read-only.

Commit

Permalink
async ice
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed Dec 31, 2019
1 parent 6a31c85 commit f30bdec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ categories = ["web-programming", "http-client"]

[dependencies]
doc-comment = "0.3"
reqwest = "0.9"
reqwest = "0.10"
hyperx = "0.15"
serde = "1"
serde_derive = "1"
Expand Down
9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ pub type Result<T> = std::result::Result<T, Error>;
macro_rules! methods {
($($method:ident,)+) => {
$(
fn $method<T: for<'de> serde::Deserialize<'de>>(&self, url: String)
async fn $method<T: for<'de> serde::Deserialize<'de>>(&self, url: String)
-> Result<T>
{
let request = self.client.$method(&url)
.headers(self.headers.clone());
debug!("REQUEST: {:?}", request);

let response = request.send()?;
let response = request.send().await?;
debug!("RESPONSE: {:?}", response);

deserialise(response)
Expand All @@ -103,11 +103,12 @@ macro_rules! paged_routes {
"Equivalent to `/api/v1/",
$url,
"`\n# Errors\nIf `access_token` is not set."),
pub fn $name(&self) -> Result<Page<$ret>> {
pub async fn $name(&self) -> Result<Page<$ret>> {
let url = self.route(concat!("/api/v1/", $url));
let response = self.client.$method(&url)
.headers(self.headers.clone())
.send()?;
.send()
.await?;

Page::new(self, response)
}
Expand Down

0 comments on commit f30bdec

Please sign in to comment.