Struct RemovalCookie
pub struct RemovalCookie<'c> { /* private fields */ }Expand description
A ResponseCookie that, when sent to the client,
removes a cookie with the same ResponseCookieId from the client’s machine, if it exists.
See ResponseCookies’s documentation for more details on cookie deletion.
Implementations§
§impl<'c> RemovalCookie<'c>
impl<'c> RemovalCookie<'c>
pub fn new<N>(name: N) -> RemovalCookie<'c>
pub fn new<N>(name: N) -> RemovalCookie<'c>
Creates a new RemovalCookie with the given name.
§Example
use biscotti::RemovalCookie;
let removal = RemovalCookie::new("name")
.set_path("/");
assert_eq!(removal.name(), "name");
assert_eq!(removal.path(), Some("/"));
assert_eq!(removal.domain(), None);pub fn name(&self) -> &str
pub fn name(&self) -> &str
Returns the name of self.
§Example
use biscotti::RemovalCookie;
let c = RemovalCookie::new("name");
assert_eq!(c.name(), "name");pub fn path(&self) -> Option<&str>
pub fn path(&self) -> Option<&str>
Returns the Path of the RemovalCookie if one was specified.
§Example
use biscotti::RemovalCookie;
let c = RemovalCookie::new("name");
assert_eq!(c.path(), None);
let c = RemovalCookie::new("name").set_path("/");
assert_eq!(c.path(), Some("/"));
let c = RemovalCookie::new("name").set_path("/sub");
assert_eq!(c.path(), Some("/sub"));pub fn domain(&self) -> Option<&str>
pub fn domain(&self) -> Option<&str>
Returns the Domain of the RemovalCookie if one was specified.
This does not consider whether the Domain is valid; validation is left
to higher-level libraries, as needed. However, if the Domain starts
with a leading ., the leading . is stripped.
§Example
use biscotti::RemovalCookie;
let c = RemovalCookie::new("name");
assert_eq!(c.domain(), None);
let c = RemovalCookie::new("name").set_domain("crates.io");
assert_eq!(c.domain(), Some("crates.io"));
let c = RemovalCookie::new("name").set_domain(".crates.io");
assert_eq!(c.domain(), Some("crates.io"));
// Note that `..crates.io` is not a valid domain.
let c = RemovalCookie::new("name").set_domain("..crates.io");
assert_eq!(c.domain(), Some(".crates.io"));pub fn into_owned(self) -> RemovalCookie<'static>
pub fn into_owned(self) -> RemovalCookie<'static>
Converts self into a RemovalCookie with a 'static lifetime with as few
allocations as possible.
§impl<'c> RemovalCookie<'c>
Methods to set fields in a RemovalCookie.
impl<'c> RemovalCookie<'c>
Methods to set fields in a RemovalCookie.
pub fn set_name<N>(self, name: N) -> RemovalCookie<'c>
pub fn set_name<N>(self, name: N) -> RemovalCookie<'c>
Sets the name of this removal cookie, replacing the current name. It returns the modified removal cookie.
§Example
use biscotti::RemovalCookie;
let mut c = RemovalCookie::new("name");
assert_eq!(c.name(), "name");
c = c.set_name("foo");
assert_eq!(c.name(), "foo");pub fn set_path<P>(self, path: P) -> RemovalCookie<'c>
pub fn set_path<P>(self, path: P) -> RemovalCookie<'c>
Sets the path property of the removal cookie to path.
It returns the modified removal cookie.
§Example
use biscotti::RemovalCookie;
let mut c = RemovalCookie::new("name");
assert_eq!(c.path(), None);
c = c.set_path("/");
assert_eq!(c.path(), Some("/"));pub fn unset_path(self) -> RemovalCookie<'c>
pub fn unset_path(self) -> RemovalCookie<'c>
Unsets the path property of the removal cookie.
It returns the modified removal cookie.
§Example
use biscotti::RemovalCookie;
let mut c = RemovalCookie::new("name");
assert_eq!(c.path(), None);
c = c.set_path("/");
assert_eq!(c.path(), Some("/"));
c = c.unset_path();
assert_eq!(c.path(), None);pub fn set_domain<D>(self, domain: D) -> RemovalCookie<'c>
pub fn set_domain<D>(self, domain: D) -> RemovalCookie<'c>
Sets the domain of self to domain.
§Example
use biscotti::RemovalCookie;
let mut c = RemovalCookie::new("name");
assert_eq!(c.domain(), None);
c = c.set_domain("rust-lang.org");
assert_eq!(c.domain(), Some("rust-lang.org"));pub fn unset_domain(self) -> RemovalCookie<'c>
pub fn unset_domain(self) -> RemovalCookie<'c>
Unsets the domain of self.
§Example
use biscotti::RemovalCookie;
let mut c = RemovalCookie::new("name");
assert_eq!(c.domain(), None);
c = c.set_domain("rust-lang.org");
assert_eq!(c.domain(), Some("rust-lang.org"));
c = c.unset_domain();
assert_eq!(c.domain(), None);Trait Implementations§
§impl<'c> Clone for RemovalCookie<'c>
impl<'c> Clone for RemovalCookie<'c>
§fn clone(&self) -> RemovalCookie<'c>
fn clone(&self) -> RemovalCookie<'c>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<'c> Debug for RemovalCookie<'c>
impl<'c> Debug for RemovalCookie<'c>
§impl<'c> From<RemovalCookie<'c>> for ResponseCookie<'c>
impl<'c> From<RemovalCookie<'c>> for ResponseCookie<'c>
§fn from(value: RemovalCookie<'c>) -> ResponseCookie<'c>
fn from(value: RemovalCookie<'c>) -> ResponseCookie<'c>
§impl<'c> From<ResponseCookieId<'c>> for RemovalCookie<'c>
impl<'c> From<ResponseCookieId<'c>> for RemovalCookie<'c>
§fn from(value: ResponseCookieId<'c>) -> RemovalCookie<'c>
fn from(value: ResponseCookieId<'c>) -> RemovalCookie<'c>
Auto Trait Implementations§
impl<'c> Freeze for RemovalCookie<'c>
impl<'c> RefUnwindSafe for RemovalCookie<'c>
impl<'c> Send for RemovalCookie<'c>
impl<'c> Sync for RemovalCookie<'c>
impl<'c> Unpin for RemovalCookie<'c>
impl<'c> UnwindSafe for RemovalCookie<'c>
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);