pub struct MultipartForm { /* private fields */ }Expand description
Generic multipart form data container
Implementations§
Source§impl MultipartForm
impl MultipartForm
Sourcepub fn file(
self,
name: impl Into<String>,
filename: impl Into<String>,
content_type: Mime,
data: impl Into<Bytes>,
) -> Self
pub fn file( self, name: impl Into<String>, filename: impl Into<String>, content_type: Mime, data: impl Into<Bytes>, ) -> Self
Add a file/binary field
Sourcepub fn boundary(self, boundary: impl Into<String>) -> Self
pub fn boundary(self, boundary: impl Into<String>) -> Self
Set a custom boundary (optional, one will be generated if not set)
Sourcepub fn into_parts(self) -> Vec<Part>
pub fn into_parts(self) -> Vec<Part>
Consume the form, yielding its parts in order. Transports use this to render the form in their native multipart type.
Sourcepub fn encode(&self) -> (String, Bytes)
pub fn encode(&self) -> (String, Bytes)
Encodes parts in insertion order, returning the boundary and body bytes.
Uses the configured boundary or generates one for this call. Names and
filenames escape ", CR and LF as %22, %0D and %0A, as browsers
do. The boundary is inserted verbatim; callers must ensure it is safe
for multipart headers and does not occur in data.
Trait Implementations§
Source§impl Clone for MultipartForm
impl Clone for MultipartForm
Source§impl Debug for MultipartForm
impl Debug for MultipartForm
Auto Trait Implementations§
impl Forget for MultipartForm
impl Freeze for MultipartForm
impl Move for MultipartForm
impl RefUnwindSafe for MultipartForm
impl Send for MultipartForm
impl Sync for MultipartForm
impl Unpin for MultipartForm
impl UnsafeUnpin for MultipartFormwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Part>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for MultipartFormwhere
RawVecInner: UnwindSafe,
*const u8: UnwindSafe,
Align8<*mut ()>: UnwindSafe,
&'static Vtable: UnwindSafe,
&'static str: UnwindSafe,
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