feat(delegate): first attempt to get it to work

With a big but ! The most simple thing to do it was to just add
additional type parameters to the respective method.

Now the type cannot be inferred, which means type-hints must be added.
This should be easy enough, but ... has to be done somehow.
This commit is contained in:
Sebastian Thiel
2015-03-09 10:44:13 +01:00
parent ac35432b3f
commit 678b6929ca
8 changed files with 1180 additions and 479 deletions

View File

@@ -2,6 +2,9 @@ use std::marker::MarkerTrait;
use std::io::{Read, Seek};
use std::borrow::BorrowMut;
use oauth2;
use hyper;
/// 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.
@@ -41,4 +44,20 @@ impl<T: Seek + Read> ReadSeek for T {}
struct JsonServerError {
error: String,
error_description: Option<String>
}
}
/// A trait specifying functionality to help controlling any request performed by the API.
/// The trait has a conservative default implementation.
///
/// It contains methods to deal with all common issues, as well with the ones related to
/// uploading media
pub trait Delegate: Clone {
/// Called whenever there is an HttpError, usually if there are network problems.
///
/// Return retry information.
fn connection_error(&mut self, hyper::HttpError) -> oauth2::Retry {
oauth2::Retry::Abort
}
}