mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
fix(rustup): rustc (be9bd7c93 2015-04-05)
* using std::convert * update to latest hyper (and other dependencies) Related to #46
This commit is contained in:
@@ -22,20 +22,20 @@
|
||||
<%block filter="rust_module_doc_comment">\
|
||||
${lib.docs(c)}
|
||||
</%block>
|
||||
#![feature(core,io,thread_sleep)]
|
||||
#![feature(std_misc)]
|
||||
// Unused attributes happen thanks to defined, but unused structures
|
||||
// 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 ... .
|
||||
#![allow(unused_imports, unused_mut, dead_code)]
|
||||
// Required for serde annotations
|
||||
#![feature(custom_derive, custom_attribute, plugin)]
|
||||
#![feature(custom_derive, custom_attribute, plugin, slice_patterns)]
|
||||
#![plugin(serde_macros)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate hyper;
|
||||
extern crate serde;
|
||||
extern crate "yup-oauth2" as oauth2;
|
||||
extern crate yup_oauth2 as oauth2;
|
||||
extern crate mime;
|
||||
extern crate url;
|
||||
|
||||
@@ -50,7 +50,7 @@ use std::marker::PhantomData;
|
||||
use serde::json;
|
||||
use std::io;
|
||||
use std::fs;
|
||||
use std::thread::sleep;
|
||||
use std::thread::sleep_ms;
|
||||
|
||||
pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, JsonServerError};
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
# end for each method
|
||||
header_methods = (('Upload', upload_methods), ('Download', download_methods), ('Subscription', subscription_methods))
|
||||
%>\
|
||||
This documentation was generated from *${util.canonical_name()}* crate version *${util.crate_version()}*, where *${revision}* is the exact revision of the *${id}* schema built by the [mako](http://www.makotemplates.org/) code generator *v${cargo.build_version}*.
|
||||
This documentation was generated from *${util.canonical_name()}* crate version *${util.crate_version()}*, where *${revision is UNDEFINED and '00000000' or revision}* is the exact revision of the *${id}* schema built by the [mako](http://www.makotemplates.org/) code generator *v${cargo.build_version}*.
|
||||
% if documentationLink:
|
||||
|
||||
Everything else about the *${util.canonical_name()}* *${api_version}* API can be found at the
|
||||
@@ -340,8 +340,8 @@ pub enum Scope {
|
||||
% endfor
|
||||
}
|
||||
|
||||
impl Str for Scope {
|
||||
fn as_slice(&self) -> &str {
|
||||
impl AsRef<str> for Scope {
|
||||
fn as_ref(&self) -> &str {
|
||||
match *self {
|
||||
% for url in auth.oauth2.scopes.keys():
|
||||
${scope_url_to_variant(name, url)} => "${url}",
|
||||
|
||||
@@ -151,8 +151,8 @@ ${self._setter_fn(resource, method, m, p, part_prop, ThisType, c)}\
|
||||
% endfor
|
||||
% endif
|
||||
pub fn ${ADD_PARAM_FN}<T>(mut self, name: T, value: T) -> ${ThisType}
|
||||
where T: Str {
|
||||
self.${api.properties.params}.insert(name.as_slice().to_string(), value.as_slice().to_string());
|
||||
where T: AsRef<str> {
|
||||
self.${api.properties.params}.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
||||
self
|
||||
}
|
||||
|
||||
@@ -169,8 +169,8 @@ ${self._setter_fn(resource, method, m, p, part_prop, ThisType, c)}\
|
||||
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
||||
/// sufficient, a read-write scope will do as well.
|
||||
pub fn add_scope<T>(mut self, scope: T) -> ${ThisType}
|
||||
where T: Str {
|
||||
self.${api.properties.scopes}.insert(scope.as_slice().to_string(), ());
|
||||
where T: AsRef<str> {
|
||||
self.${api.properties.scopes}.insert(scope.as_ref().to_string(), ());
|
||||
self
|
||||
}
|
||||
% endif
|
||||
@@ -544,7 +544,7 @@ match result {
|
||||
for &(name, ref value) in params.iter() {
|
||||
if name == "alt" {
|
||||
field_present = false;
|
||||
if value.as_slice() != "json" {
|
||||
if <String as AsRef<str>>::as_ref(&value) != "json" {
|
||||
enable = false;
|
||||
}
|
||||
break;
|
||||
@@ -596,7 +596,7 @@ else {
|
||||
}
|
||||
% else:
|
||||
if self.${api.properties.scopes}.len() == 0 {
|
||||
self.${api.properties.scopes}.insert(${scope_url_to_variant(name, default_scope, fully_qualified=True)}.as_slice().to_string(), ());
|
||||
self.${api.properties.scopes}.insert(${scope_url_to_variant(name, default_scope, fully_qualified=True)}.as_ref().to_string(), ());
|
||||
}
|
||||
% endif
|
||||
|
||||
@@ -646,7 +646,7 @@ else {
|
||||
|
||||
if params.len() > 0 {
|
||||
url.push('?');
|
||||
url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice()))));
|
||||
url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_ref()))));
|
||||
}
|
||||
|
||||
% if request_value:
|
||||
@@ -710,7 +710,7 @@ else {
|
||||
};
|
||||
% endif
|
||||
let mut client = &mut *self.hub.client.borrow_mut();
|
||||
let mut req = client.borrow_mut().request(${method_name_to_variant(m.httpMethod)}, url.as_slice())
|
||||
let mut req = client.borrow_mut().request(${method_name_to_variant(m.httpMethod)}, url.as_ref())
|
||||
.header(UserAgent(self.hub._user_agent.clone()))\
|
||||
% if supports_scopes(auth):
|
||||
|
||||
@@ -755,7 +755,7 @@ else {
|
||||
match req_result {
|
||||
Err(err) => {
|
||||
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
|
||||
sleep(d);
|
||||
sleep_ms(d.num_milliseconds() as u32);
|
||||
continue;
|
||||
}
|
||||
${delegate_finish}(false);
|
||||
@@ -766,7 +766,7 @@ else {
|
||||
let mut json_err = String::new();
|
||||
res.read_to_string(&mut json_err).unwrap();
|
||||
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
|
||||
sleep(d);
|
||||
sleep_ms(d.num_milliseconds() as u32);
|
||||
continue;
|
||||
}
|
||||
${delegate_finish}(false);
|
||||
|
||||
Reference in New Issue
Block a user