[src]
pub fn domain(self): string? {
return (self as _Cookie).domain();
}
Returns the Domain of the cookie if one was specified.
[src]
pub fn domain(self): string? {
return (self as _Cookie).domain();
}
Returns the Domain of the cookie if one was specified.
Returns the Domain of the cookie if one was specified.
Example
use std.net.http.Cookie;
let cookie = try! Cookie.parse("foo=bar; domain=example.com");
assert_eq cookie.domain(), "example.com";
[src]
pub fn expires(self): DateTime? {
return (self as _Cookie).expires();
}
Sets the expires field of self
to time
.
[src]
pub fn expires(self): DateTime? {
return (self as _Cookie).expires();
}
Sets the expires field of self
to time
.
Sets the expires field of self
to time
.
Example
use std.net.http.Cookie;
use std.time.DateTime;
use std.io;
let cookie = Cookie.new_with_string("foo", "bar");
cookie.set_expires(try! DateTime.parse("2023-04-13 09:45:26 +08:00"));
assert_eq cookie.expires(), try! DateTime.parse("2023-04-13 09:45:26 +08:00");
make_permanent
pub fn make_permanent(self)
[src]
pub fn make_permanent(self) {
(self as _Cookie).make_permanent();
}
Makes self
a permanent
cookie by extending its expiration and max
age 20 years into the future.
make_permanent
pub fn make_permanent(self)
[src]
pub fn make_permanent(self) {
(self as _Cookie).make_permanent();
}
Makes self
a permanent
cookie by extending its expiration and max
age 20 years into the future.
Makes self
a permanent
cookie by extending its expiration and max
age 20 years into the future.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
cookie.make_permanent();
make_removal
pub fn make_removal(self)
[src]
pub fn make_removal(self) {
(self as _Cookie).make_removal();
}
Make self
a removal
cookie by clearing its value, setting a max-age
of 0, and setting an expiration date far in the past.
make_removal
pub fn make_removal(self)
[src]
pub fn make_removal(self) {
(self as _Cookie).make_removal();
}
Make self
a removal
cookie by clearing its value, setting a max-age
of 0, and setting an expiration date far in the past.
Make self
a removal
cookie by clearing its value, setting a max-age
of 0, and setting an expiration date far in the past.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
cookie.make_removal();
[src]
pub fn max_age(self): Duration? {
return (self as _Cookie).max_age();
}
Returns the specified max-age of the cookie if one was specified.
[src]
pub fn max_age(self): Duration? {
return (self as _Cookie).max_age();
}
Returns the specified max-age of the cookie if one was specified.
Returns the specified max-age of the cookie if one was specified.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
assert_eq cookie.max_age(), nil;
cookie.set_max_age(30.seconds());
assert_eq cookie.max_age()!, 30.seconds();
[src]
pub fn http_only(self): bool {
return (self as _Cookie).http_only();
}
Returns whether this cookie was marked HttpOnly
or not.
[src]
pub fn http_only(self): bool {
return (self as _Cookie).http_only();
}
Returns whether this cookie was marked HttpOnly
or not.
Returns whether this cookie was marked HttpOnly
or not.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
assert_eq cookie.http_only(), false;
cookie.set_http_only(true);
assert_eq cookie.http_only(), true;
[src]
pub fn named(name: string): Cookie {
return _Cookie.named(name) as Cookie;
}
Creates a new Cookie
with the given name and an empty value.
[src]
pub fn named(name: string): Cookie {
return _Cookie.named(name) as Cookie;
}
Creates a new Cookie
with the given name and an empty value.
Creates a new Cookie
with the given name and an empty value.
Example
use std.net.http.Cookie;
let cookie = Cookie.named("foo");
assert_eq cookie.name(), "foo";
assert_eq cookie.value(), "";
[src]
pub fn new<T>(name: string, value: T): Cookie {
return _Cookie.new(name, value) as Cookie;
}
Creates a new Cookie with the given name
and serialized value
.
[src]
pub fn new<T>(name: string, value: T): Cookie {
return _Cookie.new(name, value) as Cookie;
}
Creates a new Cookie with the given name
and serialized value
.
Creates a new Cookie with the given name
and serialized value
.
Example
use std.net.http.Cookie;
use std.json;
struct User {
name: string,
id: int,
profile: Profile?
}
struct Profile {
city: string?
}
let user = try! json.parse::<User>(`{
"name": "Jason Lee",
"id": 123456,
"profile": {
"city": "Chengdu"
}
}`);
let cookie = Cookie.new("foo", user);
new_with_string
pub fn new_with_string(name: string, value: string): Cookie
[src]
pub fn new_with_string(name: string, value: string): Cookie {
return _Cookie.new_with_string(name, value) as Cookie;
}
Creates a new Cookie with the given name
and value
.
new_with_string
pub fn new_with_string(name: string, value: string): Cookie
[src]
pub fn new_with_string(name: string, value: string): Cookie {
return _Cookie.new_with_string(name, value) as Cookie;
}
Creates a new Cookie with the given name
and value
.
Creates a new Cookie with the given name
and value
.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
parse
pub fn parse(s: string): Cookie throws CookieError
[src]
pub fn parse(s: string): Cookie throws CookieError {
return try _Cookie.parse(s) as Cookie;
}
Parses a Cookie from the given HTTP cookie header value string.
parse
pub fn parse(s: string): Cookie throws CookieError
[src]
pub fn parse(s: string): Cookie throws CookieError {
return try _Cookie.parse(s) as Cookie;
}
Parses a Cookie from the given HTTP cookie header value string.
Parses a Cookie from the given HTTP cookie header value string.
Example
use std.net.http.Cookie;
let cookie = try! Cookie.parse("foo=bar; SameSite=Strict");
[src]
pub fn path(self): string? {
return (self as _Cookie).path();
}
Returns the Path
of the cookie if one was specified.
[src]
pub fn path(self): string? {
return (self as _Cookie).path();
}
Returns the Path
of the cookie if one was specified.
Returns the Path
of the cookie if one was specified.
Example
use std.net.http.Cookie;
let cookie = try! Cookie.parse("foo=bar; path=/api");
assert_eq cookie.path(), "/api";
[src]
pub fn same_site(self): SameSite? {
if (let val = (self as _Cookie).same_site()) {
switch (val) {
case 1:
return SameSite.Strict;
case 2:
return SameSite.Lax;
case 3:
return SameSite.None;
}
}
return nil;
}
Returns the SameSite
attribute of this cookie if one was specified.
[src]
pub fn same_site(self): SameSite? {
if (let val = (self as _Cookie).same_site()) {
switch (val) {
case 1:
return SameSite.Strict;
case 2:
return SameSite.Lax;
case 3:
return SameSite.None;
}
}
return nil;
}
Returns the SameSite
attribute of this cookie if one was specified.
Returns the SameSite
attribute of this cookie if one was specified.
Example
use std.net.http.{Cookie, SameSite};
let cookie = try! Cookie.parse("foo=bar; SameSite=Strict");
assert_eq cookie.same_site(), SameSite.Strict;
[src]
pub fn secure(self): bool {
return (self as _Cookie).secure();
}
Returns whether this cookie was marked Secure
or not.
[src]
pub fn secure(self): bool {
return (self as _Cookie).secure();
}
Returns whether this cookie was marked Secure
or not.
Returns whether this cookie was marked Secure
or not.
Example
use std.net.http.Cookie;
let cookie = try! Cookie.parse("foo=bar; Secure");
assert_eq cookie.secure(), true;
set_domain
pub fn set_domain(self, domain: string)
[src]
pub fn set_domain(self, domain: string) {
(self as _Cookie).set_domain(domain);
}
Sets the domain
of self
to domain
.
set_domain
pub fn set_domain(self, domain: string)
[src]
pub fn set_domain(self, domain: string) {
(self as _Cookie).set_domain(domain);
}
Sets the domain
of self
to domain
.
Sets the domain
of self
to domain
.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
cookie.set_domain("example.com");
set_expires
pub fn set_expires(self, time: DateTime)
[src]
pub fn set_expires(self, time: DateTime) {
(self as _Cookie).set_expires(time);
}
Sets the expires field of self
to time
.
set_expires
pub fn set_expires(self, time: DateTime)
[src]
pub fn set_expires(self, time: DateTime) {
(self as _Cookie).set_expires(time);
}
Sets the expires field of self
to time
.
Sets the expires field of self
to time
.
Example
use std.net.http.Cookie;
use std.time.DateTime;
let cookie = Cookie.new_with_string("foo", "bar");
cookie.set_expires(try! DateTime.parse("2023-04-13 09:45:26.123456789 +08:00"));
set_http_only
pub fn set_http_only(self, value: bool?)
[src]
pub fn set_http_only(self, value: bool?) {
(self as _Cookie).set_http_only(value);
}
Sets the value of HttpOnly
in self
to value
.
set_http_only
pub fn set_http_only(self, value: bool?)
[src]
pub fn set_http_only(self, value: bool?) {
(self as _Cookie).set_http_only(value);
}
Sets the value of HttpOnly
in self
to value
.
Sets the value of HttpOnly
in self
to value
.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
cookie.set_http_only(true);
set_max_age
pub fn set_max_age(self, value: Duration)
[src]
pub fn set_max_age(self, value: Duration) {
(self as _Cookie).set_max_age(value);
}
Sets the value of MaxAge
in self
to value
.
set_max_age
pub fn set_max_age(self, value: Duration)
[src]
pub fn set_max_age(self, value: Duration) {
(self as _Cookie).set_max_age(value);
}
Sets the value of MaxAge
in self
to value
.
Sets the value of MaxAge
in self
to value
.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
cookie.set_max_age(30.seconds());
[src]
pub fn set_name(self, value: string) {
(self as _Cookie).set_name(value);
}
Sets the name of self
to name
.
[src]
pub fn set_name(self, value: string) {
(self as _Cookie).set_name(value);
}
Sets the name of self
to name
.
Sets the name of self
to name
.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
cookie.set_name("user_session");
[src]
pub fn set_path(self, value: string) {
(self as _Cookie).set_path(value);
}
Sets the path of self to path.
[src]
pub fn set_path(self, value: string) {
(self as _Cookie).set_path(value);
}
Sets the path of self to path.
Sets the path of self to path.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
cookie.set_path("/");
set_same_site
pub fn set_same_site(self, value: SameSite?)
[src]
pub fn set_same_site(self, value: SameSite?) {
(self as _Cookie).set_same_site(value as int);
}
Sets the value of SameSite
in self
to value
.
set_same_site
pub fn set_same_site(self, value: SameSite?)
[src]
pub fn set_same_site(self, value: SameSite?) {
(self as _Cookie).set_same_site(value as int);
}
Sets the value of SameSite
in self
to value
.
Sets the value of SameSite
in self
to value
.
Example
use std.net.http.{Cookie, SameSite};
let cookie = Cookie.new_with_string("foo", "bar");
cookie.set_same_site(SameSite.Strict);
cookie.set_same_site(nil);
set_secure
pub fn set_secure(self, value: bool?)
[src]
pub fn set_secure(self, value: bool?) {
(self as _Cookie).set_secure(value);
}
Sets the value of Secure
in self
to value
.
set_secure
pub fn set_secure(self, value: bool?)
[src]
pub fn set_secure(self, value: bool?) {
(self as _Cookie).set_secure(value);
}
Sets the value of Secure
in self
to value
.
Sets the value of Secure
in self
to value
.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
cookie.set_secure(true);
cookie.set_secure(nil);
set_value_string
pub fn set_value_string(self, value: string)
[src]
pub fn set_value_string(self, value: string) {
(self as _Cookie).set_value_string(value);
}
Sets the value of self
to value
.
set_value_string
pub fn set_value_string(self, value: string)
[src]
pub fn set_value_string(self, value: string) {
(self as _Cookie).set_value_string(value);
}
Sets the value of self
to value
.
Sets the value of self
to value
.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
cookie.set_value_string("foo");
[src]
pub fn name(self): string {
return (self as _Cookie).name();
}
Returns the name of self
.
[src]
pub fn name(self): string {
return (self as _Cookie).name();
}
Returns the name of self
.
Returns the name of self
.
Example
use std.net.http.Cookie;
let cookie = Cookie.new_with_string("foo", "bar");
assert_eq cookie.name(), "foo";