Skip to main content

Part

Struct Part 

Source
pub struct Part<'m> { /* private fields */ }
Expand description

One part of a multipart request, borrowed from the Multipart it came from (parts are sequential — finish one before asking for the next).

Implementations§

Source§

impl Part<'_>

Source

pub fn name(&self) -> &str

The name from content-disposition (always present — enforced).

Source

pub fn filename(&self) -> Option<&str>

The filename, when the part is a file upload.

Source

pub fn content_type(&self) -> Option<&str>

The part’s own content-type header, when given.

Source

pub async fn chunk(&mut self) -> Result<Option<Bytes>>

The next chunk of this part’s data, or None at the part’s end. Chunked reads are bounded by the route’s cumulative body_limit, not the per-part cap — use them to process big uploads without buffering.

Source

pub async fn bytes(self) -> Result<Bytes>

The whole part, buffered — capped at the per-part cap (413 beyond it).

Source

pub async fn text(self) -> Result<String>

The whole part as UTF-8 text (400 on invalid UTF-8).

Auto Trait Implementations§

§

impl<'m> !RefUnwindSafe for Part<'m>

§

impl<'m> !Sync for Part<'m>

§

impl<'m> !UnwindSafe for Part<'m>

§

impl<'m> Freeze for Part<'m>

§

impl<'m> Send for Part<'m>

§

impl<'m> Unpin for Part<'m>

§

impl<'m> UnsafeUnpin for Part<'m>

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<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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, 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.