pub struct Cookie { /* private fields */ }
Implementations§
Source§impl Cookie
impl Cookie
pub fn builder() -> CookieBuilder
pub fn matches<T>(&self, req: Request<T>) -> bool
pub fn domain(&self) -> &Domain
pub fn subdomains(&self) -> bool
pub fn path(&self) -> &PathAttr
pub fn secure(&self) -> bool
pub fn expires_at(&self) -> i64
pub fn name(&self) -> &str
pub fn value(&self) -> &str
Trait Implementations§
Source§impl FromStr for Cookie
impl FromStr for Cookie
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a string s
to return a Cookie
.
If parsing succeeds, return the value inside Ok
, otherwise
when the string is ill-formatted return an error specific to the
inside Err
. The error type is specific to the implementation of the trait.
§Examples
use std::str::FromStr;
use quartz_cli::cookie::Cookie;
let s = "httpbin.org\tFALSE\t/somepath\tTRUE\t0\tmycookie\tsecret";
let cookie = Cookie::from_str(s).unwrap();
assert_eq!(**cookie.domain(), "httpbin.org");
assert_eq!(cookie.subdomains(), false);
assert_eq!(cookie.path().to_string(), "/somepath");
assert_eq!(cookie.secure(), true);
assert_eq!(cookie.name(), "mycookie");
assert_eq!(cookie.value(), "secret");
Source§type Err = CookieError
type Err = CookieError
The associated error which can be returned from parsing.
Source§impl ToString for Cookie
impl ToString for Cookie
Source§fn to_string(&self) -> String
fn to_string(&self) -> String
Converts a given Cookie
into a Netspace HTTP Cookie file line.
§Examples
use quartz_cli::cookie::Cookie;
let mut cookie = Cookie::builder();
cookie
.domain("httpbin.org")
.subdomains(true)
.name("mysecret")
.value("supersecretkey")
.path("/somepath");
let cookie = cookie.build().unwrap();
assert_eq!(cookie.to_string(),
"httpbin.org\tTRUE\t/somepath\tFALSE\t0\tmysecret\tsupersecretkey");
impl Eq for Cookie
Auto Trait Implementations§
impl Freeze for Cookie
impl RefUnwindSafe for Cookie
impl Send for Cookie
impl Sync for Cookie
impl Unpin for Cookie
impl UnwindSafe for Cookie
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.