pub struct MultipartField<S, E> where
    S: Stream<Item = Result<Bytes, E>> + Unpin,
    E: Into<Box<dyn StdError + Send + Sync + 'static>>, 
{ /* private fields */ }
Expand description

A single field of a MultipartStream which itself is a stream

This represents either an uploaded file, or a simple text value

Each field will have some headers and then a body. There are no assumptions made when parsing about what headers are present, but some of the helper methods here (such as content_type() & filename()) will return an error if they aren’t present. The body will be returned as an inner stream of bytes from the request, but up to the end of the field.

Fields are not concurrent against their parent multipart request. This is because multipart submissions are a single http request and we don’t support going backwards or skipping bytes. In other words you can’t read from multiple fields from the same request at the same time: you must wait for one field to finish being read before moving on.

Implementations

Return the headers for the field

You can use self.headers.get("my-header").and_then(|val| val.to_str().ok()) to get out the header if present

Return the content type of the field (if present or error)

Return the filename of the field (if present or error). The returned filename will be utf8 percent-decoded

Return the name of the field (if present or error). The returned name will be utf8 percent-decoded

Trait Implementations

Values yielded by the stream.

Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returning None if the stream is exhausted. Read more

Returns the bounds on the remaining length of the stream. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type of successful values yielded by this future

The type of failures yielded by this future

Poll this TryStream as if it were a Stream. Read more