Enum Filename

Source
pub enum Filename {
    Name(Option<String>),
    Extended(Option<String>, String),
}
Expand description

Filename parameter of Content-Disposition

Variants§

§

Name(Option<String>)

Regular filename

§

Extended(Option<String>, String)

Extended filename*

Charset is always UTF-8, because whatelse you need?

Values:

  1. Optional language tag.
  2. Correctly percent encoded string

Implementations§

Source§

impl Filename

Source

pub fn new() -> Self

Returns default Filename with empty name field.

Source

pub fn with_name(name: String) -> Self

Creates file name.

Source

pub fn with_encoded_name(name: Cow<'_, str>) -> Self

Creates file name, and checks whether it should be encoded.

Note that actual encoding would happen only when header is written. The value itself would remain unchanged in the Filename.

Source

pub fn with_extended(lang: Option<String>, name: String) -> Self

Creates extended file name.

Source

pub fn is_extended(&self) -> bool

Returns whether filename is of extended type.

Trait Implementations§

Source§

impl Debug for Filename

Source§

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

Formats the value using the given formatter. Read more

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> 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, 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.