[−][src]Struct multipart::client::SizedRequest
A wrapper around a request object that measures the request body and sets the Content-Length
header to its size in bytes.
Sized requests are more human-readable and use less bandwidth (as chunking adds visual noise and overhead), but they must be able to load their entirety, including the contents of all files and streams, into memory so the request body can be measured.
You should really only use sized requests if you intend to inspect the data manually on the server side, as it will produce a more human-readable request body. Also, of course, if the server doesn't support chunked requests or otherwise rejects them.
Trait Implementations
impl<R: HttpRequest> HttpRequest for SizedRequest<R> where
<R::Stream as HttpStream>::Error: From<R::Error>,
[src]
<R::Stream as HttpStream>::Error: From<R::Error>,
type Stream = Self
The HTTP stream type that can be opend by this request, to which the multipart data will be written. Read more
type Error = R::Error
The error type for this request.
Must be compatible with io::Error
as well as Self::HttpStream::Error
Read more
fn apply_headers(&mut self, boundary: &str, _content_len: Option<u64>) -> bool
[src]
SizedRequest
ignores _content_len
because it sets its own later.
fn open_stream(self) -> Result<Self, Self::Error>
[src]
impl<R: HttpRequest> HttpStream for SizedRequest<R> where
<R::Stream as HttpStream>::Error: From<R::Error>,
[src]
<R::Stream as HttpStream>::Error: From<R::Error>,
type Request = Self
The request type that opened this stream.
type Response = <<R as HttpRequest>::Stream as HttpStream>::Response
The response type that will be returned after the request is completed.
type Error = <<R as HttpRequest>::Stream as HttpStream>::Error
The error type for this stream.
Must be compatible with io::Error
as well as Self::Request::Error
. Read more
fn finish(self) -> Result<Self::Response, Self::Error>
[src]
impl<R> Write for SizedRequest<R>
[src]
fn write(&mut self, data: &[u8]) -> Result<usize>
[src]
fn flush(&mut self) -> Result<()>
[src]
pub fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>
1.36.0[src]
pub fn is_write_vectored(&self) -> bool
[src]
pub fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
pub fn write_all_vectored(
&mut self,
bufs: &mut [IoSlice<'_>]
) -> Result<(), Error>
[src]
&mut self,
bufs: &mut [IoSlice<'_>]
) -> Result<(), Error>
pub fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>
1.0.0[src]
pub fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Auto Trait Implementations
impl<R> RefUnwindSafe for SizedRequest<R> where
R: RefUnwindSafe,
[src]
R: RefUnwindSafe,
impl<R> Send for SizedRequest<R> where
R: Send,
[src]
R: Send,
impl<R> Sync for SizedRequest<R> where
R: Sync,
[src]
R: Sync,
impl<R> Unpin for SizedRequest<R> where
R: Unpin,
[src]
R: Unpin,
impl<R> UnwindSafe for SizedRequest<R> where
R: UnwindSafe,
[src]
R: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,