Skip to content

Commit

Permalink
fix(compat): upgrade to hyper v0.4.0
Browse files Browse the repository at this point in the history
It was basically just a find-and-replace to adapt to the changed names
of Error and Result types.
  • Loading branch information
Byron committed May 8, 2015
1 parent 8375dd0 commit 3fe2732
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions etc/api/type-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ cargo:
- serde = ">= 0.3.0"
- serde_macros = "*"
- clap = "*"
- json-tools = "*"
2 changes: 1 addition & 1 deletion src/mako/Cargo.toml.mako
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ name = "${util.program_name()}"
% endif
[dependencies]
hyper = "*"
hyper = ">= 0.4.0"
mime = "*"
yup-oauth2 = "*"
% for dep in cargo.get('dependencies', list()):
Expand Down
8 changes: 4 additions & 4 deletions src/rust/api/cmn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub trait Delegate {
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
///
/// Return retry information.
fn http_error(&mut self, &hyper::HttpError) -> Retry {
fn http_error(&mut self, &hyper::Error) -> Retry {
Retry::Abort
}

Expand Down Expand Up @@ -248,7 +248,7 @@ impl Delegate for DefaultDelegate {}
#[derive(Debug)]
pub enum Error {
/// The http connection failed
HttpError(hyper::HttpError),
HttpError(hyper::Error),

/// An attempt was made to upload a resource with size stored in field `.0`
/// even though the maximum upload size is what is stored in field `.1`.
Expand Down Expand Up @@ -587,7 +587,7 @@ pub struct ResumableUploadHelper<'a, A: 'a> {
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>> {
fn query_transfer_status(&mut self) -> std::result::Result<u64, hyper::Result<hyper::client::Response>> {
loop {
match self.client.post(self.url)
.header(UserAgent(self.user_agent.to_string()))
Expand Down Expand Up @@ -623,7 +623,7 @@ impl<'a, A> ResumableUploadHelper<'a, A>
/// returns None if operation was cancelled by delegate, or the HttpResult.
/// It can be that we return the result just because we didn't understand the status code -
/// caller should check for status himself before assuming it's OK to use
pub fn upload(&mut self) -> Option<hyper::HttpResult<hyper::client::Response>> {
pub fn upload(&mut self) -> Option<hyper::Result<hyper::client::Response>> {
let mut start = match self.start_at {
Some(s) => s,
None => match self.query_transfer_status() {
Expand Down

0 comments on commit 3fe2732

Please sign in to comment.