pub struct MultipartResult {
pub files: HashMap<String, Vec<UploadedFile>>,
pub fields: HashMap<String, String>,
}Expand description
multipart 解析结果 — 对齐 PHP $_FILES + $_POST
Fields§
§files: HashMap<String, Vec<UploadedFile>>文件字段(字段名 → UploadedFile 列表)
对齐 PHP $_FILES,每个字段可能有多个文件(多文件上传)
fields: HashMap<String, String>普通字段(字段名 → 值)
对齐 PHP $_POST
Implementations§
Source§impl MultipartResult
impl MultipartResult
Sourcepub fn file(&self, name: &str) -> Option<&UploadedFile>
pub fn file(&self, name: &str) -> Option<&UploadedFile>
获取单个文件(对齐 PHP Request::file($name) 返回单个文件)
PHP 行为:
- name 为空 → 返回全部
- name 存在 → 返回该字段的第一个文件
Sourcepub fn file_count(&self) -> usize
pub fn file_count(&self) -> usize
获取文件数量
Trait Implementations§
Source§impl Debug for MultipartResult
impl Debug for MultipartResult
Source§impl Default for MultipartResult
impl Default for MultipartResult
Source§fn default() -> MultipartResult
fn default() -> MultipartResult
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MultipartResult
impl RefUnwindSafe for MultipartResult
impl Send for MultipartResult
impl Sync for MultipartResult
impl Unpin for MultipartResult
impl UnsafeUnpin for MultipartResult
impl UnwindSafe for MultipartResult
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.