pub struct UploadBody { /* private fields */ }Expand description
The request body of an upload.
A body has one of two forms:
bytesgives the whole body. The request declares itsContent-Length, and hyper takes the bytes in frames of 64 KiB. A followed redirect sends the bytes again.channelstreams the body. The caller writes the body into theUploadWriterwhile the upload runs. Over HTTP/1.1, the body travels chunked.
If a channel body is dropped before an upload sends it, or after its upload
ends, each write of its writer fails with
io::ErrorKind::BrokenPipe. If a POST
body is at its end when the fetcher hands over the request, the request
declares a Content-Length of zero.
Implementations§
Source§impl UploadBody
impl UploadBody
Sourcepub fn bytes(bytes: Vec<u8>) -> UploadBody
pub fn bytes(bytes: Vec<u8>) -> UploadBody
Creates a body of bytes.
The request sends the vector in frames cut from it with no copy.
Sourcepub fn channel() -> (UploadBody, UploadWriter)
pub fn channel() -> (UploadBody, UploadWriter)
Creates a streamed body and the writer that fills it.
Trait Implementations§
Source§impl Debug for UploadBody
impl Debug for UploadBody
Auto Trait Implementations§
impl !Freeze for UploadBody
impl RefUnwindSafe for UploadBody
impl Send for UploadBody
impl Sync for UploadBody
impl Unpin for UploadBody
impl UnsafeUnpin for UploadBody
impl UnwindSafe for UploadBody
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more