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, filenames, and boundaries are inserted verbatim; callers must ensure they are safe for multipart headers and that the boundary 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 Freeze for MultipartForm
impl RefUnwindSafe for MultipartForm
impl Send for MultipartForm
impl Sync for MultipartForm
impl Unpin for MultipartForm
impl UnsafeUnpin for MultipartForm
impl UnwindSafe for MultipartForm
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