Struct cookie::Display

source ·
pub struct Display<'a, 'c: 'a> {
    pub(crate) cookie: &'a Cookie<'c>,
    pub(crate) strip: bool,
}
Expand description

Wrapper around Cookie whose Display implementation either percent-encodes the cookie’s name and value, skips displaying the cookie’s parameters (only displaying it’s name and value), or both.

A value of this type can be obtained via [Cookie::encoded()] and Cookie::stripped(), or an arbitrary chaining of the two methods. This type should only be used for its Display implementation.

§Example

use cookie::Cookie;

let c = Cookie::build(("my name", "this; value%?")).secure(true).build();
assert_eq!(&c.stripped().to_string(), "my name=this; value%?");

Fields§

§cookie: &'a Cookie<'c>§strip: bool

Implementations§

source§

impl<'a, 'c> Display<'a, 'c>

source

pub(crate) fn new_stripped(cookie: &'a Cookie<'c>) -> Self

source

pub fn stripped(self) -> Self

Only display the name and value.

Trait Implementations§

source§

impl<'a, 'c: 'a> Display for Display<'a, 'c>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, 'c> Freeze for Display<'a, 'c>

§

impl<'a, 'c> RefUnwindSafe for Display<'a, 'c>

§

impl<'a, 'c> Send for Display<'a, 'c>

§

impl<'a, 'c> Sync for Display<'a, 'c>

§

impl<'a, 'c> Unpin for Display<'a, 'c>

§

impl<'a, 'c> UnwindSafe for Display<'a, 'c>

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> ToString for T
where T: Display + ?Sized,

source§

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