mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
feat(mbuild): resumable-upload infrastructure
Layout the `ResumableUploadHelper` and implement the entire logic with the mbuild renerator. All that's left to be done is to implement the 'chunked upload' method. The borrow checker helped me to prevent a bug as well.
This commit is contained in:
@@ -290,4 +290,30 @@ 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);
|
||||
|
||||
/// A utility type to perform a resumable upload from start to end.
|
||||
pub struct ResumableUploadHelper<'a, NC: 'a> {
|
||||
pub client: &'a mut hyper::client::Client<NC>,
|
||||
pub delegate: &'a mut Delegate,
|
||||
pub url: &'a str,
|
||||
pub reader: &'a mut ReadSeek,
|
||||
pub media_type: Mime,
|
||||
pub content_size: u64
|
||||
}
|
||||
|
||||
impl<'a, NC> ResumableUploadHelper<'a, NC>
|
||||
where NC: hyper::net::NetworkConnector {
|
||||
pub fn upload(&'a mut self) -> hyper::HttpResult<hyper::client::Response> {
|
||||
Err(hyper::error::HttpError::HttpStatusError)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user