Skip to content

Commit

Permalink
fix(hyper-client): adjust to hyper client
Browse files Browse the repository at this point in the history
* deal with hyper client not using a type-parameter anymore
* fix incorrect documentation link (use '_' instead of '-')

Fixes #47
  • Loading branch information
Byron committed Apr 8, 2015
1 parent 6f2149b commit 191e822
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/mako/Cargo.toml.mako
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%! from util import (estr, hash_comment, library_to_crate_name) %>\
<%! from util import (estr, hash_comment, library_to_crate_name, to_extern_crate_name) %>\
<%namespace name="util" file="lib/util.mako"/>\
<%block filter="hash_comment">\
<%util:gen_info source="${self.uri}" />\
Expand All @@ -13,7 +13,7 @@ repository = "${util.github_source_root_url()}"
% if documentationLink is not UNDEFINED and documentationLink:
homepage = "${documentationLink}"
% endif
documentation = "${cargo.doc_base_url}/${util.crate_name()}"
documentation = "${cargo.doc_base_url}/${to_extern_crate_name(util.crate_name())}"
license = "${copyright.license_abbrev}"
keywords = ["${name[:20]}", ${", ".join(estr(cargo.keywords))}]
Expand Down
4 changes: 0 additions & 4 deletions src/mako/api/lib.rs.mako
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ use std::cell::RefCell;
use std::borrow::BorrowMut;
use std::default::Default;
use std::collections::BTreeMap;
use std::marker::PhantomData;
use serde::json;
use std::io;
use std::fs;
Expand Down Expand Up @@ -79,8 +78,6 @@ pub struct ${hub_type}${ht_params} {
client: RefCell<C>,
auth: RefCell<A>,
_user_agent: String,

_m: PhantomData<NC>
}

impl<'a, ${', '.join(HUB_TYPE_PARAMETERS)}> Hub for ${hub_type}${ht_params} {}
Expand All @@ -93,7 +90,6 @@ impl<'a, ${', '.join(HUB_TYPE_PARAMETERS)}> ${hub_type}${ht_params}
client: RefCell::new(client),
auth: RefCell::new(authenticator),
_user_agent: "${default_user_agent}".to_string(),
_m: PhantomData
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/mako/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
'%': 1,
}

HUB_TYPE_PARAMETERS = ('C', 'NC', 'A')
HUB_TYPE_PARAMETERS = ('C', 'A')

# ==============================================================================
## @name Filters
Expand Down Expand Up @@ -827,8 +827,7 @@ def hub_type_params_s():

# return a list of where statements to server as bounds for the hub.
def hub_type_bounds():
return ['NC: hyper::net::NetworkConnector',
'C: BorrowMut<hyper::Client<NC>>',
return ['C: BorrowMut<hyper::Client>',
'A: oauth2::GetToken']

# Returns True if this API has particular authentication scopes to choose from
Expand Down
9 changes: 4 additions & 5 deletions src/rust/api/cmn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ impl HeaderFormat for RangeResponseHeader {
}

/// A utility type to perform a resumable upload from start to end.
pub struct ResumableUploadHelper<'a, NC: 'a, A: 'a> {
pub client: &'a mut hyper::client::Client<NC>,
pub struct ResumableUploadHelper<'a, A: 'a> {
pub client: &'a mut hyper::client::Client,
pub delegate: &'a mut Delegate,
pub start_at: Option<u64>,
pub auth: &'a mut A,
Expand All @@ -494,9 +494,8 @@ pub struct ResumableUploadHelper<'a, NC: 'a, A: 'a> {
pub content_length: u64
}

impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
where NC: hyper::net::NetworkConnector,
A: oauth2::GetToken {
impl<'a, A> ResumableUploadHelper<'a, A>
where A: oauth2::GetToken {

fn query_transfer_status(&mut self) -> std::result::Result<u64, hyper::HttpResult<hyper::client::Response>> {
loop {
Expand Down

0 comments on commit 191e822

Please sign in to comment.