diff --git a/src/mako/lib.rs.mako b/src/mako/lib.rs.mako index 2843bc80804..929d451e462 100644 --- a/src/mako/lib.rs.mako +++ b/src/mako/lib.rs.mako @@ -6,7 +6,7 @@ <% from util import (new_context, rust_comment, rust_doc_comment, rust_module_doc_comment, rb_type, hub_type, mangle_ident, hub_type_params_s, - hub_type_bounds, rb_type_params_s, find_fattest_resource) + hub_type_bounds, rb_type_params_s, find_fattest_resource, HUB_TYPE_PARAMETERS) c = new_context(schemas, resources) hub_type = hub_type(c.schemas, util.canonical_name()) @@ -19,9 +19,9 @@ <%block filter="rust_module_doc_comment">\ ${lib.docs(c)} -#![feature(core,io)] +#![feature(core,io, old_io)] // DEBUG !! TODO: Remove this -#![allow(dead_code)] +#![allow(dead_code, deprecated)] // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . @@ -37,8 +37,6 @@ extern crate url; pub mod cmn; use std::collections::HashMap; -use std::marker::PhantomData; -use std::borrow::BorrowMut; use std::cell::RefCell; use std::default::Default; use std::collections::BTreeMap; @@ -84,21 +82,19 @@ ${lib.scope_enum()} ${lib.hub_usage_example(c)}\ pub struct ${hub_type}${ht_params} { - client: RefCell, + client: RefCell>, auth: RefCell, - _m: PhantomData } -impl<'a, C, NC, A> Hub for ${hub_type}${ht_params} {} +impl<'a, ${', '.join(HUB_TYPE_PARAMETERS)}> Hub for ${hub_type}${ht_params} {} -impl<'a, C, NC, A> ${hub_type}${ht_params} +impl<'a, ${', '.join(HUB_TYPE_PARAMETERS)}> ${hub_type}${ht_params} where ${', '.join(hub_type_bounds())} { - pub fn new(client: C, authenticator: A) -> ${hub_type}${ht_params} { + pub fn new(client: hyper::Client, authenticator: A) -> ${hub_type}${ht_params} { ${hub_type} { client: RefCell::new(client), auth: RefCell::new(authenticator), - _m: PhantomData, } } diff --git a/src/mako/lib/mbuild.mako b/src/mako/lib/mbuild.mako index 935530a7d25..7467b38e313 100644 --- a/src/mako/lib/mbuild.mako +++ b/src/mako/lib/mbuild.mako @@ -80,7 +80,6 @@ ${self.usage(resource, method, m, params, request_value, parts)}\ pub struct ${ThisType} where NC: 'a, - C: 'a, A: 'a, { hub: &'a ${hub_type_name}${hub_type_params_s()}, @@ -430,7 +429,7 @@ else { url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); loop { - match self.hub.client.borrow_mut().borrow_mut().request(Method::Extension("${m.httpMethod}".to_string()), &url) + match self.hub.client.borrow_mut().request(Method::Extension("${m.httpMethod}".to_string()), url.as_slice()) .header(UserAgent("google-api-rust-client/${cargo.build_version}".to_string())) % if request_value: .header(ContentType(Mime(TopLevel::Application, SubLevel::Json, Default::default()))) @@ -457,33 +456,12 @@ else { } } - % if response_schema: let response: ${response_schema.id} = Default::default(); % else: let response = (); % endif - - ## let mut params: Vec<(String, String)> = Vec::with_capacity - ## // note: cloned() shouldn't be needed, see issue - ## // https://github.com/servo/rust-url/issues/81 - ## let req = form_urlencoded::serialize( - ## [("client_id", client_id), - ## ("scope", scopes.into_iter() - ## .map(|s| s.as_slice()) - ## .intersperse(" ") - ## .collect::() - ## .as_slice())].iter().cloned()); - - ## match self.client.borrow_mut().post(FlowType::Device.as_slice()) - ## .header(ContentType("application/x-www-form-urlencoded".parse().unwrap())) - ## .body(req.as_slice()) - ## .send() { - ## Err(err) => { - ## return RequestResult::Error(err); - ## } - cmn::Result::Success(response) } diff --git a/src/mako/lib/rbuild.mako b/src/mako/lib/rbuild.mako index ce8d9172b04..62bed795dcc 100644 --- a/src/mako/lib/rbuild.mako +++ b/src/mako/lib/rbuild.mako @@ -39,7 +39,6 @@ let rb = hub.${mangle_ident(resource)}(); pub struct ${ThisType} where NC: 'a, - C: 'a, A: 'a, { hub: &'a ${hub_type_name}${hub_type_params_s()}, diff --git a/src/mako/lib/util.py b/src/mako/lib/util.py index e32b6abe3d8..4acdf7de7d3 100644 --- a/src/mako/lib/util.py +++ b/src/mako/lib/util.py @@ -98,7 +98,7 @@ '%': 1, } -HUB_TYPE_PARAMETERS = ('C', 'NC', 'A') +HUB_TYPE_PARAMETERS = ('NC', 'A') # ============================================================================== ## @name Filters @@ -732,7 +732,6 @@ 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> + 'a", 'A: oauth2::GetToken'] # return list of type bounds required by method builder