Skip to main content

ExtValue

Struct ExtValue 

Source
pub struct ExtValue<'a>(pub &'a str);
Expand description

A logical string wrapped for use as an RFC 8187 ext-value, in header parameters like Content-Disposition’s filename*.

The string is escaped lazily as this is displayed, so a caller can write it straight into a header it is already building instead of allocating an intermediate string. The output includes the charset prefix, so it goes directly after the = of a header parameter.

Unlike encode_header_value, this escapes everything outside a narrow attr-char set, because an ext-value sits inside a header parameter rather than spanning a whole value.

§Examples

use objectstore_types::headers::ExtValue;

assert_eq!(ExtValue("réport.pdf").to_string(), "UTF-8''r%C3%A9port.pdf");

Tuple Fields§

§0: &'a str

Trait Implementations§

Source§

impl<'a> Debug for ExtValue<'a>

Source§

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

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

impl Display for ExtValue<'_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ExtValue<'a>

§

impl<'a> RefUnwindSafe for ExtValue<'a>

§

impl<'a> Send for ExtValue<'a>

§

impl<'a> Sync for ExtValue<'a>

§

impl<'a> Unpin for ExtValue<'a>

§

impl<'a> UnsafeUnpin for ExtValue<'a>

§

impl<'a> UnwindSafe for ExtValue<'a>

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> Same for T

Source§

type Output = T

Should always be Self
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.