pub enum DispositionParam {
Name(String),
Filename(String),
FilenameExt(ExtendedValue),
Unknown(String, String),
UnknownExt(String, ExtendedValue),
}
Expand description
Parameter in ContentDisposition
.
Examples
use actix_web::http::header::DispositionParam;
let param = DispositionParam::Filename(String::from("sample.txt"));
assert!(param.is_filename());
assert_eq!(param.as_filename().unwrap(), "sample.txt");
Variants§
Name(String)
For DispositionType::FormData
(i.e. multipart/form-data), the name of an field from
the form.
Filename(String)
A plain file name.
FilenameExt(ExtendedValue)
An extended file name. It must not exist for ContentType::Formdata
according to
RFC7578 Section 4.2.
Unknown(String, String)
An unrecognized regular parameter as defined in RFC5987 as reg-parameter, in RFC6266 as token “=” value. Recipients should ignore unrecognizable parameters.
UnknownExt(String, ExtendedValue)
Implementations§
source§impl DispositionParam
impl DispositionParam
sourcepub fn is_filename(&self) -> bool
pub fn is_filename(&self) -> bool
Returns true
if the paramater is Filename
.
sourcepub fn is_filename_ext(&self) -> bool
pub fn is_filename_ext(&self) -> bool
Returns true
if the paramater is FilenameExt
.
sourcepub fn is_unknown<T>(&self, name: T) -> boolwhere
T: AsRef<str>,
pub fn is_unknown<T>(&self, name: T) -> boolwhere
T: AsRef<str>,
Returns true
if the paramater is Unknown
and the name
matches.
sourcepub fn is_unknown_ext<T>(&self, name: T) -> boolwhere
T: AsRef<str>,
pub fn is_unknown_ext<T>(&self, name: T) -> boolwhere
T: AsRef<str>,
Returns true
if the paramater is UnknownExt
and the
name
matches.
sourcepub fn as_filename(&self) -> Option<&str>
pub fn as_filename(&self) -> Option<&str>
Returns the filename if applicable.
sourcepub fn as_filename_ext(&self) -> Option<&ExtendedValue>
pub fn as_filename_ext(&self) -> Option<&ExtendedValue>
Returns the filename* if applicable.
sourcepub fn as_unknown<T>(&self, name: T) -> Option<&str>where
T: AsRef<str>,
pub fn as_unknown<T>(&self, name: T) -> Option<&str>where
T: AsRef<str>,
Returns the value of the unrecognized regular parameter if it is
Unknown
and the name
matches.
sourcepub fn as_unknown_ext<T>(&self, name: T) -> Option<&ExtendedValue>where
T: AsRef<str>,
pub fn as_unknown_ext<T>(&self, name: T) -> Option<&ExtendedValue>where
T: AsRef<str>,
Returns the value of the unrecognized extended parameter if it is
Unknown
and the name
matches.
Trait Implementations§
source§impl Clone for DispositionParam
impl Clone for DispositionParam
source§fn clone(&self) -> DispositionParam
fn clone(&self) -> DispositionParam
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DispositionParam
impl Debug for DispositionParam
source§impl Display for DispositionParam
impl Display for DispositionParam
source§impl PartialEq<DispositionParam> for DispositionParam
impl PartialEq<DispositionParam> for DispositionParam
source§fn eq(&self, other: &DispositionParam) -> bool
fn eq(&self, other: &DispositionParam) -> bool
impl StructuralPartialEq for DispositionParam
Auto Trait Implementations§
impl RefUnwindSafe for DispositionParam
impl Send for DispositionParam
impl Sync for DispositionParam
impl Unpin for DispositionParam
impl UnwindSafe for DispositionParam
Blanket Implementations§
source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
&self
to an expression for Diesel’s query builder. Read more