pub struct Form { /* private fields */ }Expand description
A multipart form containing multiple parts.
Use the builder pattern to construct a form with multiple parts,
then convert it to a body with into_body().
Implementations§
Source§impl Form
impl Form
Sourcepub fn with_boundary(boundary: impl Into<String>) -> Self
pub fn with_boundary(boundary: impl Into<String>) -> Self
Create a new form with a custom boundary.
The boundary should be a unique string that doesn’t appear in any part data.
Sourcepub fn text(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn text(self, name: impl Into<String>, value: impl Into<String>) -> Self
Add a text field to the form.
Sourcepub fn file(
self,
name: impl Into<String>,
filename: impl Into<String>,
data: impl Into<Bytes>,
) -> Self
pub fn file( self, name: impl Into<String>, filename: impl Into<String>, data: impl Into<Bytes>, ) -> Self
Add a file to the form.
Sourcepub fn content_type(&self) -> String
pub fn content_type(&self) -> String
Get the Content-Type header value for this form.
Returns multipart/form-data; boundary=<boundary>.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Form
impl RefUnwindSafe for Form
impl Send for Form
impl Sync for Form
impl Unpin for Form
impl UnwindSafe for Form
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