pub struct MultipartForm { /* private fields */ }Expand description
Generic multipart form data container
Implementations§
Source§impl MultipartForm
impl MultipartForm
Sourcepub fn new() -> MultipartForm
pub fn new() -> MultipartForm
Create a new empty multipart form
Sourcepub fn part(self, part: Part) -> MultipartForm
pub fn part(self, part: Part) -> MultipartForm
Add a part to the form
Sourcepub fn text(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> MultipartForm
pub fn text( self, name: impl Into<String>, value: impl Into<String>, ) -> MultipartForm
Add a text field
Sourcepub fn file(
self,
name: impl Into<String>,
filename: impl Into<String>,
content_type: Mime,
data: impl Into<Bytes>,
) -> MultipartForm
pub fn file( self, name: impl Into<String>, filename: impl Into<String>, content_type: Mime, data: impl Into<Bytes>, ) -> MultipartForm
Add a file/binary field
Sourcepub fn boundary(self, boundary: impl Into<String>) -> MultipartForm
pub fn boundary(self, boundary: impl Into<String>) -> MultipartForm
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§fn clone(&self) -> MultipartForm
fn clone(&self) -> MultipartForm
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MultipartForm
impl Debug for MultipartForm
Source§impl Default for MultipartForm
impl Default for MultipartForm
Source§fn default() -> MultipartForm
fn default() -> MultipartForm
Returns the “default value” for a type. Read more
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more