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.
It is not supposed to contain
any non-ASCII characters when used in a Content-Disposition HTTP response header, where
FilenameExt
with charset UTF-8 may be used instead
in case there are Unicode characters in file names.
FilenameExt(ExtendedValue)
An extended file name. It must not exist for ContentType::Formdata
according to
RFC 7578 §4.2.
Unknown(String, String)
An unrecognized regular parameter as defined in
RFC 5987 §3.2.1 as
reg-parameter
, in
RFC 6266 §4.1 as
token "=" value
. Recipients should ignore unrecognizable parameters.
UnknownExt(String, ExtendedValue)
An unrecognized extended parameter as defined in
RFC 5987 §3.2.1 as
ext-parameter
, in
RFC 6266 §4.1 as
ext-token "=" ext-value
. The single trailing asterisk is not included. Recipients should
ignore unrecognizable parameters.
Implementations
sourceimpl DispositionParam
impl DispositionParam
sourcepub fn is_filename(&self) -> bool
pub fn is_filename(&self) -> bool
Returns true
if the parameter is Filename
.
sourcepub fn is_filename_ext(&self) -> bool
pub fn is_filename_ext(&self) -> bool
Returns true
if the parameter is FilenameExt
.
sourcepub fn is_unknown<T: AsRef<str>>(&self, name: T) -> bool
pub fn is_unknown<T: AsRef<str>>(&self, name: T) -> bool
Returns true
if the parameter is Unknown
and the name
matches.
sourcepub fn is_unknown_ext<T: AsRef<str>>(&self, name: T) -> bool
pub fn is_unknown_ext<T: AsRef<str>>(&self, name: T) -> bool
Returns true
if the parameter 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: AsRef<str>>(&self, name: T) -> Option<&str>
pub fn as_unknown<T: AsRef<str>>(&self, name: T) -> Option<&str>
Returns the value of the unrecognized regular parameter if it is
Unknown
and the name
matches.
sourcepub fn as_unknown_ext<T: AsRef<str>>(&self, name: T) -> Option<&ExtendedValue>
pub fn as_unknown_ext<T: AsRef<str>>(&self, name: T) -> Option<&ExtendedValue>
Returns the value of the unrecognized extended parameter if it is
Unknown
and the name
matches.
Trait Implementations
sourceimpl Clone for DispositionParam
impl Clone for DispositionParam
sourcefn clone(&self) -> DispositionParam
fn clone(&self) -> DispositionParam
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for DispositionParam
impl Debug for DispositionParam
sourceimpl Display for DispositionParam
impl Display for DispositionParam
sourceimpl PartialEq<DispositionParam> for DispositionParam
impl PartialEq<DispositionParam> for DispositionParam
sourcefn eq(&self, other: &DispositionParam) -> bool
fn eq(&self, other: &DispositionParam) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
impl Eq for DispositionParam
impl StructuralEq for DispositionParam
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more