Struct cookie::Cookie
[−]
[src]
pub struct Cookie { pub name: String, pub value: String, pub expires: Option<Tm>, pub max_age: Option<u64>, pub domain: Option<String>, pub path: Option<String>, pub secure: bool, pub httponly: bool, pub custom: BTreeMap<String, String>, }
Holds all the data for a single cookie
Fields
name: String
value: String
expires: Option<Tm>
max_age: Option<u64>
domain: Option<String>
path: Option<String>
secure: bool
httponly: bool
custom: BTreeMap<String, String>
Methods
impl Cookie
[src]
fn new(name: String, value: String) -> Cookie
Creates a new Cookie
instance from key and value strings
Example
use cookie::Cookie; let c = Cookie::new("foo".into(), "bar".into()); assert_eq!(c.name, "foo"); assert_eq!(c.value, "bar");
fn parse(s: &str) -> Result<Cookie, Error>
Attempts to parse a string into a Cookie
instance
Example
use cookie::Cookie; let c = Cookie::parse("foo=bar; httponly").expect("Failed to parse cookie"); assert_eq!(c.name, "foo"); assert_eq!(c.value, "bar"); assert!(c.httponly);
fn pair(&self) -> AttrVal
Returns the (name, value) pair for this Cookie
instance
Trait Implementations
impl PartialEq for Cookie
[src]
fn eq(&self, __arg_0: &Cookie) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Cookie) -> bool
This method tests for !=
.
impl Clone for Cookie
[src]
fn clone(&self) -> Cookie
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more