pub struct Form { /* private fields */ }Available on crate features
client and multipart only.Expand description
A multipart/form-data request body.
A Form is a series of Parts, it can be sent through
RequestBuilder::multipart, which will set the
Content-Type header (with the generated boundary) and the body automatically.
Implementations§
Source§impl Form
impl Form
Sourcepub fn text<N, V>(self, name: N, value: V) -> Self
pub fn text<N, V>(self, name: N, value: V) -> Self
Add a text field to the form.
This is a shortcut for Form::part with Part::text.
Sourcepub fn part<N>(self, name: N, part: Part) -> Self
pub fn part<N>(self, name: N, part: Part) -> Self
Add a Part to the form with the given field name.
Sourcepub async fn file<N, P>(self, name: N, path: P) -> Result<Self>
pub async fn file<N, P>(self, name: N, path: P) -> Result<Self>
Add a file field to the form, the file will be read and streamed lazily.
The Content-Type is guessed from the file extension, and the filename is taken from the
path if it is not overridden. This is a shortcut for Form::part with Part::file.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Form
impl !UnwindSafe for Form
impl Freeze for Form
impl Send for Form
impl Sync for Form
impl Unpin for Form
impl UnsafeUnpin 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