From 191e822c5a93771e32e85bc5c00ef450c6719fb6 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 8 Apr 2015 16:51:46 +0200 Subject: [PATCH] fix(hyper-client): adjust to hyper client * deal with hyper client not using a type-parameter anymore * fix incorrect documentation link (use '_' instead of '-') Fixes #47 --- src/mako/Cargo.toml.mako | 4 ++-- src/mako/api/lib.rs.mako | 4 ---- src/mako/lib/util.py | 5 ++--- src/rust/api/cmn.rs | 9 ++++----- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/mako/Cargo.toml.mako b/src/mako/Cargo.toml.mako index 39df776a999..a93ce8e60a5 100644 --- a/src/mako/Cargo.toml.mako +++ b/src/mako/Cargo.toml.mako @@ -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}" />\ @@ -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))}] diff --git a/src/mako/api/lib.rs.mako b/src/mako/api/lib.rs.mako index 46fd6613c60..07c896649de 100644 --- a/src/mako/api/lib.rs.mako +++ b/src/mako/api/lib.rs.mako @@ -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; @@ -79,8 +78,6 @@ pub struct ${hub_type}${ht_params} { client: RefCell, auth: RefCell, _user_agent: String, - - _m: PhantomData } impl<'a, ${', '.join(HUB_TYPE_PARAMETERS)}> Hub for ${hub_type}${ht_params} {} @@ -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 } } diff --git a/src/mako/lib/util.py b/src/mako/lib/util.py index f92abbccbd9..0a837558c60 100644 --- a/src/mako/lib/util.py +++ b/src/mako/lib/util.py @@ -109,7 +109,7 @@ '%': 1, } -HUB_TYPE_PARAMETERS = ('C', 'NC', 'A') +HUB_TYPE_PARAMETERS = ('C', 'A') # ============================================================================== ## @name Filters @@ -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>', + return ['C: BorrowMut', 'A: oauth2::GetToken'] # Returns True if this API has particular authentication scopes to choose from diff --git a/src/rust/api/cmn.rs b/src/rust/api/cmn.rs index a36d8318545..a5ad2e0ecb4 100644 --- a/src/rust/api/cmn.rs +++ b/src/rust/api/cmn.rs @@ -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, +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, pub delegate: &'a mut Delegate, pub start_at: Option, pub auth: &'a mut A, @@ -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> { loop {