pub struct MultipartFormData;Expand description
Parser for multipart/form-data bodies.
Decodes a body into its parts using the boundary declared by the request
Content-Type header, without depending on any external multipart crate.
Implementations§
Source§impl MultipartFormData
Implementation for MultipartFormData.
impl MultipartFormData
Implementation for MultipartFormData.
Sourcepub fn get_boundary<C>(content_type: C) -> Option<String>
pub fn get_boundary<C>(content_type: C) -> Option<String>
Reads the boundary parameter out of a multipart/form-data content type.
The parameter is matched case-insensitively and accepts both a quoted and
a bare value, so the clients that emit boundary="abc" and the clients
that emit boundary=abc are both accepted. A parameter that carries no
= is skipped rather than aborting the scan.
§Arguments
C- The content type header value, which requires theAsRef<str>bound.
§Returns
Option<MultipartFormDataBoundary>- The declared boundary, orNonewhen absent.
Sourcepub fn is_form_data<C>(content_type: C) -> bool
pub fn is_form_data<C>(content_type: C) -> bool
Sourcepub fn parse<B>(body: B, boundary: &str) -> Option<Vec<BodyPart>>
pub fn parse<B>(body: B, boundary: &str) -> Option<Vec<BodyPart>>
Decodes every part of a multipart/form-data body.
A body that carries no declared boundary, a body whose final boundary is
not the closing one, and a part that declares no name all yield None.
§Arguments
B- The raw request body, which requires theAsRef<[u8]>bound.&str- The declared boundary, without its leading dash pair.
§Returns
Option<MultipartFormDataParts>- The decoded parts, orNonewhen malformed.
Sourcepub fn try_get_part<K>(parts: &[BodyPart], name: K) -> Option<&BodyPart>
pub fn try_get_part<K>(parts: &[BodyPart], name: K) -> Option<&BodyPart>
Sourcepub fn try_get_part_text<K>(parts: &[BodyPart], name: K) -> Option<String>
pub fn try_get_part_text<K>(parts: &[BodyPart], name: K) -> Option<String>
Tries to get a plain text field by its form field name.
A part that uploads a file is skipped, so a file field never silently decodes as text.
§Arguments
&[BodyPart]- The decoded parts of the body.K- The form field name, which requires theAsRef<str>bound.
§Returns
Option<BodyFormValue>- The field value, orNonewhen absent or a file.
Sourcepub fn parse_url_encoded<B>(
body: B,
) -> HashMap<String, String, BuildHasherDefault<Hasher>>
pub fn parse_url_encoded<B>( body: B, ) -> HashMap<String, String, BuildHasherDefault<Hasher>>
Trait Implementations§
Source§impl Clone for MultipartFormData
impl Clone for MultipartFormData
Source§fn clone(&self) -> MultipartFormData
fn clone(&self) -> MultipartFormData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MultipartFormData
Source§impl Debug for MultipartFormData
impl Debug for MultipartFormData
Source§impl Default for MultipartFormData
impl Default for MultipartFormData
Source§fn default() -> MultipartFormData
fn default() -> MultipartFormData
Source§impl<'de> Deserialize<'de> for MultipartFormData
impl<'de> Deserialize<'de> for MultipartFormData
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MultipartFormData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MultipartFormData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for MultipartFormData
Source§impl PartialEq for MultipartFormData
impl PartialEq for MultipartFormData
Source§impl Serialize for MultipartFormData
impl Serialize for MultipartFormData
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for MultipartFormData
Auto Trait Implementations§
impl Freeze for MultipartFormData
impl RefUnwindSafe for MultipartFormData
impl Send for MultipartFormData
impl Sync for MultipartFormData
impl Unpin for MultipartFormData
impl UnsafeUnpin for MultipartFormData
impl UnwindSafe for MultipartFormData
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.