pub enum DispositionParam {
Name(String),
Filename(String),
FilenameExt(ExtendedValue),
Unknown(String, String),
UnknownExt(String, ExtendedValue),
}Expand description
Parameter in ContentDisposition.
§Examples
use requiem_http::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
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: AsRef<str>>(&self, name: T) -> bool
pub fn is_unknown<T: AsRef<str>>(&self, name: T) -> bool
Returns true if the paramater 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 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: 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§
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 for DispositionParam
impl PartialEq for DispositionParam
impl StructuralPartialEq for DispositionParam
Auto Trait Implementations§
impl Freeze for DispositionParam
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> 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,
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> 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>
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>
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 more