pub struct MultipartField<M: ReadEntry> {
pub headers: FieldHeaders,
pub data: MultipartData<M>,
}
Expand description
A field in a multipart request with its associated headers and data.
Fields§
§headers: FieldHeaders
The headers for this field, including the name, filename, and content-type, if provided.
§Warning: Values are Client-Provided
Everything in this struct are values from the client and should be considered untrustworthy. This crate makes no effort to validate or sanitize any client inputs.
data: MultipartData<M>
The field’s data.
Implementations§
Source§impl<M: ReadEntry> MultipartField<M>
impl<M: ReadEntry> MultipartField<M>
Sourcepub fn is_text(&self) -> bool
pub fn is_text(&self) -> bool
Returns true
if this field has no content-type or the content-type is text/...
.
This typically means it can be read to a string, but it could still be using an unsupported
character encoding, so decoding to String
needs to ensure that the data is valid UTF-8.
Note also that the field contents may be too large to reasonably fit in memory.
The .save()
adapter can be used to enforce a size limit.
Detecting character encodings by any means is (currently) beyond the scope of this crate.
Sourcepub fn next_entry(self) -> ReadEntryResult<M>
pub fn next_entry(self) -> ReadEntryResult<M>
Read the next entry in the request.