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:
Sebastian Thiel
2015-04-07 11:53:47 +02:00
parent 919ae4d8ae
commit 91861dcb71
354 changed files with 62261 additions and 24815 deletions

View File

@@ -1,11 +1,10 @@
// COPY OF 'src/rust/api/cmn.rs'
// DO NOT EDIT
use std::marker::MarkerTrait;
use std::io::{self, Read, Seek, Cursor, Write, SeekFrom};
use std;
use std::fmt::{self, Display};
use std::str::FromStr;
use std::thread::sleep;
use std::thread::sleep_ms;
use mime::{Mime, TopLevel, SubLevel, Attr, Value};
use oauth2::{TokenType, Retry, self};
@@ -21,35 +20,35 @@ use serde;
/// Identifies the Hub. There is only one per library, this trait is supposed
/// to make intended use more explicit.
/// The hub allows to access all resource methods more easily.
pub trait Hub: MarkerTrait {}
pub trait Hub {}
/// Identifies types for building methods of a particular resource type
pub trait MethodsBuilder: MarkerTrait {}
pub trait MethodsBuilder {}
/// Identifies types which represent builders for a particular resource method
pub trait CallBuilder: MarkerTrait {}
pub trait CallBuilder {}
/// Identifies types which can be inserted and deleted.
/// Types with this trait are most commonly used by clients of this API.
pub trait Resource: MarkerTrait {}
pub trait Resource {}
/// Identifies types which are used in API responses.
pub trait ResponseResult: MarkerTrait {}
pub trait ResponseResult {}
/// Identifies types which are used in API requests.
pub trait RequestValue: MarkerTrait {}
pub trait RequestValue {}
/// Identifies types which are not actually used by the API
/// This might be a bug within the google API schema.
pub trait UnusedType: MarkerTrait {}
pub trait UnusedType {}
/// Identifies types which are only used as part of other types, which
/// usually are carrying the `Resource` trait.
pub trait Part: MarkerTrait {}
pub trait Part {}
/// Identifies types which are only used by other types internally.
/// They have no special meaning, this trait just marks them for completeness.
pub trait NestedType: MarkerTrait {}
pub trait NestedType {}
/// A utility to specify reader types which provide seeking capabilities too
pub trait ReadSeek: Seek + Read {}
@@ -380,14 +379,10 @@ impl<'a> Read for MultiPartReader<'a> {
}
}
/// The `X-Upload-Content-Type` header.
#[derive(Clone, PartialEq, Debug)]
pub struct XUploadContentType(pub Mime);
impl_header!(XUploadContentType,
"X-Upload-Content-Type",
Mime);
header!{
#[doc="The `X-Upload-Content-Type` header."]
(XUploadContentType, "X-Upload-Content-Type") => [Mime]
}
#[derive(Clone, PartialEq, Debug)]
pub struct Chunk {
@@ -519,7 +514,7 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
Some(hh) if r.status == StatusCode::PermanentRedirect => hh,
None|Some(_) => {
if let Retry::After(d) = self.delegate.http_failure(&r, None) {
sleep(d);
sleep_ms(d.num_milliseconds() as u32);
continue;
}
return Err(Ok(r))
@@ -529,7 +524,7 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
}
Err(err) => {
if let Retry::After(d) = self.delegate.http_error(&err) {
sleep(d);
sleep_ms(d.num_milliseconds() as u32);
continue;
}
return Err(Err(err))
@@ -586,7 +581,7 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let Retry::After(d) = self.delegate.http_failure(&res, serde::json::from_str(&json_err).ok()) {
sleep(d);
sleep_ms(d.num_milliseconds() as u32);
continue;
}
}
@@ -594,7 +589,7 @@ impl<'a, NC, A> ResumableUploadHelper<'a, NC, A>
},
Err(err) => {
if let Retry::After(d) = self.delegate.http_error(&err) {
sleep(d);
sleep_ms(d.num_milliseconds() as u32);
continue;
}
return Some(Err(err))

View File

@@ -67,8 +67,8 @@
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate "yup-oauth2" as oauth2;
//! extern crate "google-cloudlatencytest2" as cloudlatencytest2;
//! extern crate yup_oauth2 as oauth2;
//! extern crate google_cloudlatencytest2 as cloudlatencytest2;
//! use cloudlatencytest2::Stats;
//! use cloudlatencytest2::{Result, Error};
//! # #[test] fn egal() {
@@ -167,20 +167,20 @@
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
#![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;
@@ -195,7 +195,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};
@@ -213,8 +213,8 @@ pub enum Scope {
MonitoringReadonly,
}
impl Str for Scope {
fn as_slice(&self) -> &str {
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::MonitoringReadonly => "https://www.googleapis.com/auth/monitoring.readonly",
}
@@ -241,8 +241,8 @@ impl Default for Scope {
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate "yup-oauth2" as oauth2;
/// extern crate "google-cloudlatencytest2" as cloudlatencytest2;
/// extern crate yup_oauth2 as oauth2;
/// extern crate google_cloudlatencytest2 as cloudlatencytest2;
/// use cloudlatencytest2::Stats;
/// use cloudlatencytest2::{Result, Error};
/// # #[test] fn egal() {
@@ -471,8 +471,8 @@ impl ResponseResult for StatsReply {}
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate "yup-oauth2" as oauth2;
/// extern crate "google-cloudlatencytest2" as cloudlatencytest2;
/// extern crate yup_oauth2 as oauth2;
/// extern crate google_cloudlatencytest2 as cloudlatencytest2;
///
/// # #[test] fn egal() {
/// use std::default::Default;
@@ -554,8 +554,8 @@ impl<'a, C, NC, A> StatscollectionMethods<'a, C, NC, A> {
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate "yup-oauth2" as oauth2;
/// # extern crate "google-cloudlatencytest2" as cloudlatencytest2;
/// # extern crate yup_oauth2 as oauth2;
/// # extern crate google_cloudlatencytest2 as cloudlatencytest2;
/// use cloudlatencytest2::AggregatedStats;
/// # #[test] fn egal() {
/// # use std::default::Default;
@@ -620,13 +620,13 @@ impl<'a, C, NC, A> StatscollectionUpdateaggregatedstatCall<'a, C, NC, A> where N
let mut url = "https://cloudlatencytest-pa.googleapis.com/v2/statscollection/updateaggregatedstats".to_string();
if self._scopes.len() == 0 {
self._scopes.insert(Scope::MonitoringReadonly.as_slice().to_string(), ());
self._scopes.insert(Scope::MonitoringReadonly.as_ref().to_string(), ());
}
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()))));
}
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
@@ -649,7 +649,7 @@ impl<'a, C, NC, A> StatscollectionUpdateaggregatedstatCall<'a, C, NC, A> where N
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
let mut req_result = {
let mut client = &mut *self.hub.client.borrow_mut();
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_slice())
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
.header(UserAgent(self.hub._user_agent.clone()))
.header(auth_header.clone())
.header(ContentType(json_mime_type.clone()))
@@ -663,7 +663,7 @@ impl<'a, C, NC, A> StatscollectionUpdateaggregatedstatCall<'a, C, NC, A> where N
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;
}
dlg.finished(false);
@@ -674,7 +674,7 @@ impl<'a, C, NC, A> StatscollectionUpdateaggregatedstatCall<'a, C, NC, A> where N
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;
}
dlg.finished(false);
@@ -738,8 +738,8 @@ impl<'a, C, NC, A> StatscollectionUpdateaggregatedstatCall<'a, C, NC, A> where N
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *alt* (query-string) - Data format for the response.
pub fn param<T>(mut self, name: T, value: T) -> StatscollectionUpdateaggregatedstatCall<'a, C, NC, A>
where T: Str {
self._additional_params.insert(name.as_slice().to_string(), value.as_slice().to_string());
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
@@ -755,8 +755,8 @@ impl<'a, C, NC, A> StatscollectionUpdateaggregatedstatCall<'a, C, NC, A> where N
/// 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) -> StatscollectionUpdateaggregatedstatCall<'a, C, NC, A>
where T: Str {
self._scopes.insert(scope.as_slice().to_string(), ());
where T: AsRef<str> {
self._scopes.insert(scope.as_ref().to_string(), ());
self
}
}
@@ -773,8 +773,8 @@ impl<'a, C, NC, A> StatscollectionUpdateaggregatedstatCall<'a, C, NC, A> where N
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate "yup-oauth2" as oauth2;
/// # extern crate "google-cloudlatencytest2" as cloudlatencytest2;
/// # extern crate yup_oauth2 as oauth2;
/// # extern crate google_cloudlatencytest2 as cloudlatencytest2;
/// use cloudlatencytest2::Stats;
/// # #[test] fn egal() {
/// # use std::default::Default;
@@ -839,13 +839,13 @@ impl<'a, C, NC, A> StatscollectionUpdatestatCall<'a, C, NC, A> where NC: hyper::
let mut url = "https://cloudlatencytest-pa.googleapis.com/v2/statscollection/updatestats".to_string();
if self._scopes.len() == 0 {
self._scopes.insert(Scope::MonitoringReadonly.as_slice().to_string(), ());
self._scopes.insert(Scope::MonitoringReadonly.as_ref().to_string(), ());
}
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()))));
}
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
@@ -868,7 +868,7 @@ impl<'a, C, NC, A> StatscollectionUpdatestatCall<'a, C, NC, A> where NC: hyper::
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
let mut req_result = {
let mut client = &mut *self.hub.client.borrow_mut();
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_slice())
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
.header(UserAgent(self.hub._user_agent.clone()))
.header(auth_header.clone())
.header(ContentType(json_mime_type.clone()))
@@ -882,7 +882,7 @@ impl<'a, C, NC, A> StatscollectionUpdatestatCall<'a, C, NC, A> where NC: hyper::
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;
}
dlg.finished(false);
@@ -893,7 +893,7 @@ impl<'a, C, NC, A> StatscollectionUpdatestatCall<'a, C, NC, A> where NC: hyper::
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;
}
dlg.finished(false);
@@ -957,8 +957,8 @@ impl<'a, C, NC, A> StatscollectionUpdatestatCall<'a, C, NC, A> where NC: hyper::
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *alt* (query-string) - Data format for the response.
pub fn param<T>(mut self, name: T, value: T) -> StatscollectionUpdatestatCall<'a, C, NC, A>
where T: Str {
self._additional_params.insert(name.as_slice().to_string(), value.as_slice().to_string());
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
@@ -974,8 +974,8 @@ impl<'a, C, NC, A> StatscollectionUpdatestatCall<'a, C, NC, A> where NC: hyper::
/// 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) -> StatscollectionUpdatestatCall<'a, C, NC, A>
where T: Str {
self._scopes.insert(scope.as_slice().to_string(), ());
where T: AsRef<str> {
self._scopes.insert(scope.as_ref().to_string(), ());
self
}
}