Skip to main content

ContentDisposition

Struct ContentDisposition 

Source
pub struct ContentDisposition {
    pub disposition: DispositionType,
    pub parameters: Vec<DispositionParam>,
}
Expand description

A Content-Disposition header, (re)defined in RFC6266.

The Content-Disposition response header field is used to convey additional information about how to process the response payload, and also can be used to attach additional metadata, such as the filename to use when saving the response payload locally.

§ABNF

content-disposition = "Content-Disposition" ":"
                      disposition-type *( ";" disposition-parm )

disposition-type    = "inline" | "attachment" | disp-ext-type
                      ; case-insensitive

disp-ext-type       = token

disposition-parm    = filename-parm | disp-ext-parm

filename-parm       = "filename" "=" value
                    | "filename*" "=" ext-value

disp-ext-parm       = token "=" value
                    | ext-token "=" ext-value

ext-token           = <the characters in token, followed by "*">

Fields§

§disposition: DispositionType

The disposition

§parameters: Vec<DispositionParam>

Disposition parameters

Implementations§

Source§

impl ContentDisposition

Source

pub fn is_inline(&self) -> bool

Returns true if type is Inline.

Source

pub fn is_attachment(&self) -> bool

Returns true if type is Attachment.

Source

pub fn is_form_data(&self) -> bool

Returns true if type is FormData.

Source

pub fn is_ext(&self, disp_type: impl AsRef<str>) -> bool

Returns true if type is Ext and the disp_type matches.

Source

pub fn get_name(&self) -> Option<&str>

Return the value of name if exists.

Source

pub fn get_filename(&self) -> Option<&str>

Return the value of filename if exists.

Source

pub fn get_filename_ext(&self) -> Option<&ExtendedValue>

Return the value of filename* if exists.

Source

pub fn get_unknown(&self, name: impl AsRef<str>) -> Option<&str>

Return the value of the parameter which the name matches.

Source

pub fn get_unknown_ext(&self, name: impl AsRef<str>) -> Option<&ExtendedValue>

Return the value of the extended parameter which the name matches.

Trait Implementations§

Source§

impl Clone for ContentDisposition

Source§

fn clone(&self) -> ContentDisposition

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContentDisposition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ContentDisposition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Header for ContentDisposition

Source§

fn header_name() -> &'static str

Returns the name of the header field this belongs to. Read more
Source§

fn parse_header<'a, T>(raw: &'a T) -> Result<ContentDisposition, Error>
where T: RawLike<'a>,

Parse a header from a raw stream of bytes. Read more
Source§

fn fmt_header(&self, f: &mut Formatter<'_, '_>) -> Result

Format a header to outgoing stream. Read more
Source§

impl PartialEq for ContentDisposition

Source§

fn eq(&self, other: &ContentDisposition) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StandardHeader for ContentDisposition

Source§

fn http_header_name() -> HeaderName

The HeaderName from the http crate for this header.
Source§

impl StructuralPartialEq for ContentDisposition

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.