Skip to main content

Multipart

Struct Multipart 

Source
pub struct Multipart<T: Part> { /* private fields */ }
Expand description

Multipart is a builder for multipart/form-data.

Implementations§

Source§

impl<T: Part> Multipart<T>

Source

pub fn new() -> Self

Create a new multipart with random boundary.

Source

pub fn with_boundary(self, boundary: &str) -> Self

Set the boundary with given string.

Source

pub fn part(self, part: T) -> Self

Insert a part into multipart.

Source

pub fn into_parts(self) -> Vec<T>

Into parts.

Source

pub fn parse(self, bs: Bytes) -> Result<Self>

Parse a response with multipart body into Multipart.

Source

pub fn apply(self, builder: Builder) -> Result<Request<Buffer>>

Consume the input and generate a request with multipart body.

This function will make sure content_type and content_length set correctly.

Trait Implementations§

Source§

impl<T: Debug + Part> Debug for Multipart<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Part> Default for Multipart<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Multipart<T>

§

impl<T> RefUnwindSafe for Multipart<T>
where T: RefUnwindSafe,

§

impl<T> Send for Multipart<T>
where T: Send,

§

impl<T> Sync for Multipart<T>
where T: Sync,

§

impl<T> Unpin for Multipart<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Multipart<T>

§

impl<T> UnwindSafe for Multipart<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,