Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 307d3f4

Browse files
committed
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.
1 parent 98f4bba commit 307d3f4

5 files changed

Lines changed: 754 additions & 350 deletions

File tree

gen/youtube3/src/cmn.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,4 +292,30 @@ impl<'a> Read for MultiPartReader<'a> {
292292
}
293293
}
294294
}
295+
}
296+
297+
298+
/// The `X-Upload-Content-Type` header.
299+
#[derive(Clone, PartialEq, Debug)]
300+
pub struct XUploadContentType(pub Mime);
301+
302+
impl_header!(XUploadContentType,
303+
"X-Upload-Content-Type",
304+
Mime);
305+
306+
/// A utility type to perform a resumable upload from start to end.
307+
pub struct ResumableUploadHelper<'a, NC: 'a> {
308+
pub client: &'a mut hyper::client::Client<NC>,
309+
pub delegate: &'a mut Delegate,
310+
pub url: &'a str,
311+
pub reader: &'a mut ReadSeek,
312+
pub media_type: Mime,
313+
pub content_size: u64
314+
}
315+
316+
impl<'a, NC> ResumableUploadHelper<'a, NC>
317+
where NC: hyper::net::NetworkConnector {
318+
pub fn upload(&'a mut self) -> hyper::HttpResult<hyper::client::Response> {
319+
Err(hyper::error::HttpError::HttpStatusError)
320+
}
295321
}

0 commit comments

Comments
 (0)