Struct multipart::server::Multipart [−][src]
pub struct Multipart<B> { /* fields omitted */ }The server-side implementation of multipart/form-data requests.
Implements Borrow<R> to allow access to the request body, if desired.
Methods
impl Multipart<()>[src]
impl Multipart<()>pub fn from_request<R: HttpRequest>(req: R) -> Result<Multipart<R::Body>, R>[src]
pub fn from_request<R: HttpRequest>(req: R) -> Result<Multipart<R::Body>, R>If the given HttpRequest is a multipart/form-data POST request,
return the request body wrapped in the multipart reader. Otherwise,
returns the original request.
impl<B: Read> Multipart<B>[src]
impl<B: Read> Multipart<B>pub fn with_body<Bnd: Into<String>>(body: B, boundary: Bnd) -> Self[src]
pub fn with_body<Bnd: Into<String>>(body: B, boundary: Bnd) -> SelfConstruct a new Multipart with the given body reader and boundary.
This will prepend the requisite "--" to the boundary.
pub fn read_entry(&mut self) -> Result<Option<MultipartField<B>>>[src]
pub fn read_entry(&mut self) -> Result<Option<MultipartField<B>>>Read the next entry from this multipart request, returning a struct with the field's name and
data. See MultipartField for more info.
##Warning: Risk of Data Loss
If the previously returned entry had contents of type MultipartField::File,
calling this again will discard any unread contents of that entry.
pub fn foreach_entry<F>(&mut self, foreach: F) -> Result<()> where
F: FnMut(MultipartField<B>), [src]
pub fn foreach_entry<F>(&mut self, foreach: F) -> Result<()> where
F: FnMut(MultipartField<B>), Call f for each entry in the multipart request.
This is a substitute for Rust not supporting streaming iterators (where the return value
from next() borrows the iterator for a bound lifetime).
Returns Ok(()) when all fields have been read, or the first error.
pub fn save_all(&mut self) -> SaveResult[src]
pub fn save_all(&mut self) -> SaveResultRead the request fully, parsing all fields and saving all files in a new temporary directory under the OS temporary directory.
If there is an error in reading the request, returns the partial result along with the
error. See SaveResult for more information.
pub fn save_all_under<P: AsRef<Path>>(&mut self, dir: P) -> SaveResult[src]
pub fn save_all_under<P: AsRef<Path>>(&mut self, dir: P) -> SaveResultRead the request fully, parsing all fields and saving all files in a new temporary
directory under dir.
If there is an error in reading the request, returns the partial result along with the
error. See SaveResult for more information.