Struct multipart::client::lazy::Multipart [−][src]
pub struct Multipart<'n, 'd> { /* fields omitted */ }A multipart request which writes all fields at once upon being provided an output stream.
Sacrifices static dispatch for support for dynamic construction. Reusable.
####Lifetimes
'n: Lifetime for field names; will only escape this struct inLazyIoError<'n>.'d: Lifetime for data: will only escape this struct inPreparedFields<'d>.
Methods
impl<'n, 'd> Multipart<'n, 'd>[src]
impl<'n, 'd> Multipart<'n, 'd>pub fn client_request<U: IntoUrl>(
&mut self,
client: &Client,
url: U
) -> HyperResult<Response>[src]
pub fn client_request<U: IntoUrl>(
&mut self,
client: &Client,
url: U
) -> HyperResult<Response>Feature: hyper
Complete a POST request with the given hyper::client::Client and URL.
Supplies the fields in the body, optionally setting the content-length header if applicable (all added fields were text or files, i.e. no streams).
pub fn client_request_mut<U: IntoUrl, F: FnOnce(RequestBuilder) -> RequestBuilder>(
&mut self,
client: &Client,
url: U,
mut_fn: F
) -> HyperResult<Response>[src]
pub fn client_request_mut<U: IntoUrl, F: FnOnce(RequestBuilder) -> RequestBuilder>(
&mut self,
client: &Client,
url: U,
mut_fn: F
) -> HyperResult<Response>Feature: hyper
Complete a POST request with the given hyper::client::Client and URL;
allows mutating the hyper::client::RequestBuilder via the passed closure.
Note that the body, and the ContentType and ContentLength headers will be
overwritten, either by this method or by Hyper.
impl<'n, 'd> Multipart<'n, 'd>[src]
impl<'n, 'd> Multipart<'n, 'd>pub fn new() -> Self[src]
pub fn new() -> SelfInitialize a new lazy dynamic request.
ⓘImportant traits for &'a mut Rpub fn add_text<N, T>(&mut self, name: N, text: T) -> &mut Self where
N: Into<Cow<'n, str>>,
T: Into<Cow<'d, str>>, [src]
pub fn add_text<N, T>(&mut self, name: N, text: T) -> &mut Self where
N: Into<Cow<'n, str>>,
T: Into<Cow<'d, str>>, Add a text field to this request.
ⓘImportant traits for &'a mut Rpub fn add_file<N, P>(&mut self, name: N, path: P) -> &mut Self where
N: Into<Cow<'n, str>>,
P: Into<Cow<'d, Path>>, [src]
pub fn add_file<N, P>(&mut self, name: N, path: P) -> &mut Self where
N: Into<Cow<'n, str>>,
P: Into<Cow<'d, Path>>, ⓘImportant traits for &'a mut Rpub fn add_stream<N, R, F>(
&mut self,
name: N,
stream: R,
filename: Option<F>,
mime: Option<Mime>
) -> &mut Self where
N: Into<Cow<'n, str>>,
R: Read + 'd,
F: Into<Cow<'n, str>>, [src]
pub fn add_stream<N, R, F>(
&mut self,
name: N,
stream: R,
filename: Option<F>,
mime: Option<Mime>
) -> &mut Self where
N: Into<Cow<'n, str>>,
R: Read + 'd,
F: Into<Cow<'n, str>>, Add a generic stream field to this request,
pub fn send<R: HttpRequest>(
&mut self,
req: R
) -> Result<<R::Stream as HttpStream>::Response, LazyError<'n, <R::Stream as HttpStream>::Error>>[src]
pub fn send<R: HttpRequest>(
&mut self,
req: R
) -> Result<<R::Stream as HttpStream>::Response, LazyError<'n, <R::Stream as HttpStream>::Error>>Convert req to HttpStream, write out the fields in this request, and finish the
request, returning the response if successful, or the first error encountered.
pub fn prepare(&mut self) -> Result<PreparedFields<'d>, LazyIoError<'n>>[src]
pub fn prepare(&mut self) -> Result<PreparedFields<'d>, LazyIoError<'n>>Export the multipart data contained in this lazy request as an adaptor which implements Read.
A certain amount of field data will be buffered. See
prepare_threshold() for more information on this behavior.
pub fn prepare_threshold(
&mut self,
buffer_threshold: Option<u64>
) -> Result<PreparedFields<'d>, LazyIoError<'n>>[src]
pub fn prepare_threshold(
&mut self,
buffer_threshold: Option<u64>
) -> Result<PreparedFields<'d>, LazyIoError<'n>>Export the multipart data contained in this lazy request to an adaptor which implements Read.
Buffering
For efficiency, text and file fields smaller than buffer_threshold are copied to an in-memory buffer. If None,
all fields are copied to memory.
Trait Implementations
impl<'n, 'd> Debug for Multipart<'n, 'd>[src]
impl<'n, 'd> Debug for Multipart<'n, 'd>fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<'n, 'd> Default for Multipart<'n, 'd>[src]
impl<'n, 'd> Default for Multipart<'n, 'd>