Skip to main content

web_sys/features/
gen_CookieInit.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    #[wasm_bindgen(extends = "::js_sys::Object", js_name = "CookieInit")]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `CookieInit` dictionary."]
10    #[doc = ""]
11    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
12    pub type CookieInit;
13    #[doc = "Get the `domain` field of this object."]
14    #[doc = ""]
15    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
16    #[wasm_bindgen(method, getter = "domain")]
17    pub fn get_domain(this: &CookieInit) -> Option<::alloc::string::String>;
18    #[doc = "Change the `domain` field of this object."]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
21    #[wasm_bindgen(method, setter = "domain")]
22    pub fn set_domain(this: &CookieInit, val: Option<&str>);
23    #[doc = "Get the `expires` field of this object."]
24    #[doc = ""]
25    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
26    #[wasm_bindgen(method, getter = "expires")]
27    pub fn get_expires(this: &CookieInit) -> Option<f64>;
28    #[doc = "Change the `expires` field of this object."]
29    #[doc = ""]
30    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
31    #[wasm_bindgen(method, setter = "expires")]
32    pub fn set_expires(this: &CookieInit, val: Option<f64>);
33    #[doc = "Get the `maxAge` field of this object."]
34    #[doc = ""]
35    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
36    #[wasm_bindgen(method, getter = "maxAge")]
37    pub fn get_max_age(this: &CookieInit) -> Option<f64>;
38    #[doc = "Change the `maxAge` field of this object."]
39    #[doc = ""]
40    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
41    #[wasm_bindgen(method, setter = "maxAge")]
42    pub fn set_max_age(this: &CookieInit, val: Option<f64>);
43    #[doc = "Change the `maxAge` field of this object."]
44    #[doc = ""]
45    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
46    #[wasm_bindgen(method, setter = "maxAge")]
47    pub fn set_max_age_opt_i32(this: &CookieInit, val: Option<i32>);
48    #[doc = "Change the `maxAge` field of this object."]
49    #[doc = ""]
50    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
51    #[wasm_bindgen(method, setter = "maxAge")]
52    pub fn set_max_age_opt_f64(this: &CookieInit, val: Option<f64>);
53    #[doc = "Get the `name` field of this object."]
54    #[doc = ""]
55    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
56    #[wasm_bindgen(method, getter = "name")]
57    pub fn get_name(this: &CookieInit) -> ::alloc::string::String;
58    #[doc = "Change the `name` field of this object."]
59    #[doc = ""]
60    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
61    #[wasm_bindgen(method, setter = "name")]
62    pub fn set_name(this: &CookieInit, val: &str);
63    #[doc = "Get the `partitioned` field of this object."]
64    #[doc = ""]
65    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
66    #[wasm_bindgen(method, getter = "partitioned")]
67    pub fn get_partitioned(this: &CookieInit) -> Option<bool>;
68    #[doc = "Change the `partitioned` field of this object."]
69    #[doc = ""]
70    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
71    #[wasm_bindgen(method, setter = "partitioned")]
72    pub fn set_partitioned(this: &CookieInit, val: bool);
73    #[doc = "Get the `path` field of this object."]
74    #[doc = ""]
75    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
76    #[wasm_bindgen(method, getter = "path")]
77    pub fn get_path(this: &CookieInit) -> Option<::alloc::string::String>;
78    #[doc = "Change the `path` field of this object."]
79    #[doc = ""]
80    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
81    #[wasm_bindgen(method, setter = "path")]
82    pub fn set_path(this: &CookieInit, val: &str);
83    #[cfg(feature = "CookieSameSite")]
84    #[doc = "Get the `sameSite` field of this object."]
85    #[doc = ""]
86    #[doc = "*This API requires the following crate features to be activated: `CookieInit`, `CookieSameSite`*"]
87    #[wasm_bindgen(method, getter = "sameSite")]
88    pub fn get_same_site(this: &CookieInit) -> Option<CookieSameSite>;
89    #[cfg(feature = "CookieSameSite")]
90    #[doc = "Change the `sameSite` field of this object."]
91    #[doc = ""]
92    #[doc = "*This API requires the following crate features to be activated: `CookieInit`, `CookieSameSite`*"]
93    #[wasm_bindgen(method, setter = "sameSite")]
94    pub fn set_same_site(this: &CookieInit, val: CookieSameSite);
95    #[doc = "Get the `value` field of this object."]
96    #[doc = ""]
97    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
98    #[wasm_bindgen(method, getter = "value")]
99    pub fn get_value(this: &CookieInit) -> ::alloc::string::String;
100    #[doc = "Change the `value` field of this object."]
101    #[doc = ""]
102    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
103    #[wasm_bindgen(method, setter = "value")]
104    pub fn set_value(this: &CookieInit, val: &str);
105}
106impl CookieInit {
107    #[doc = "Construct a new `CookieInit`."]
108    #[doc = ""]
109    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
110    pub fn new(name: &str, value: &str) -> Self {
111        #[allow(unused_mut)]
112        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
113        ret.set_name(name);
114        ret.set_value(value);
115        ret
116    }
117    #[deprecated = "Use `set_domain()` instead."]
118    pub fn domain(&mut self, val: Option<&str>) -> &mut Self {
119        self.set_domain(val);
120        self
121    }
122    #[deprecated = "Use `set_expires()` instead."]
123    pub fn expires(&mut self, val: Option<f64>) -> &mut Self {
124        self.set_expires(val);
125        self
126    }
127    #[deprecated = "Use `set_max_age()` instead."]
128    pub fn max_age(&mut self, val: Option<f64>) -> &mut Self {
129        self.set_max_age(val);
130        self
131    }
132    #[deprecated = "Use `set_name()` instead."]
133    pub fn name(&mut self, val: &str) -> &mut Self {
134        self.set_name(val);
135        self
136    }
137    #[deprecated = "Use `set_partitioned()` instead."]
138    pub fn partitioned(&mut self, val: bool) -> &mut Self {
139        self.set_partitioned(val);
140        self
141    }
142    #[deprecated = "Use `set_path()` instead."]
143    pub fn path(&mut self, val: &str) -> &mut Self {
144        self.set_path(val);
145        self
146    }
147    #[cfg(feature = "CookieSameSite")]
148    #[deprecated = "Use `set_same_site()` instead."]
149    pub fn same_site(&mut self, val: CookieSameSite) -> &mut Self {
150        self.set_same_site(val);
151        self
152    }
153    #[deprecated = "Use `set_value()` instead."]
154    pub fn value(&mut self, val: &str) -> &mut Self {
155        self.set_value(val);
156        self
157    }
158}