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 `name` field of this object."]
34    #[doc = ""]
35    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
36    #[wasm_bindgen(method, getter = "name")]
37    pub fn get_name(this: &CookieInit) -> ::alloc::string::String;
38    #[doc = "Change the `name` field of this object."]
39    #[doc = ""]
40    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
41    #[wasm_bindgen(method, setter = "name")]
42    pub fn set_name(this: &CookieInit, val: &str);
43    #[doc = "Get the `partitioned` field of this object."]
44    #[doc = ""]
45    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
46    #[wasm_bindgen(method, getter = "partitioned")]
47    pub fn get_partitioned(this: &CookieInit) -> Option<bool>;
48    #[doc = "Change the `partitioned` field of this object."]
49    #[doc = ""]
50    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
51    #[wasm_bindgen(method, setter = "partitioned")]
52    pub fn set_partitioned(this: &CookieInit, val: bool);
53    #[doc = "Get the `path` field of this object."]
54    #[doc = ""]
55    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
56    #[wasm_bindgen(method, getter = "path")]
57    pub fn get_path(this: &CookieInit) -> Option<::alloc::string::String>;
58    #[doc = "Change the `path` field of this object."]
59    #[doc = ""]
60    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
61    #[wasm_bindgen(method, setter = "path")]
62    pub fn set_path(this: &CookieInit, val: &str);
63    #[cfg(feature = "CookieSameSite")]
64    #[doc = "Get the `sameSite` field of this object."]
65    #[doc = ""]
66    #[doc = "*This API requires the following crate features to be activated: `CookieInit`, `CookieSameSite`*"]
67    #[wasm_bindgen(method, getter = "sameSite")]
68    pub fn get_same_site(this: &CookieInit) -> Option<CookieSameSite>;
69    #[cfg(feature = "CookieSameSite")]
70    #[doc = "Change the `sameSite` field of this object."]
71    #[doc = ""]
72    #[doc = "*This API requires the following crate features to be activated: `CookieInit`, `CookieSameSite`*"]
73    #[wasm_bindgen(method, setter = "sameSite")]
74    pub fn set_same_site(this: &CookieInit, val: CookieSameSite);
75    #[doc = "Get the `value` field of this object."]
76    #[doc = ""]
77    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
78    #[wasm_bindgen(method, getter = "value")]
79    pub fn get_value(this: &CookieInit) -> ::alloc::string::String;
80    #[doc = "Change the `value` field of this object."]
81    #[doc = ""]
82    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
83    #[wasm_bindgen(method, setter = "value")]
84    pub fn set_value(this: &CookieInit, val: &str);
85}
86impl CookieInit {
87    #[doc = "Construct a new `CookieInit`."]
88    #[doc = ""]
89    #[doc = "*This API requires the following crate features to be activated: `CookieInit`*"]
90    pub fn new(name: &str, value: &str) -> Self {
91        #[allow(unused_mut)]
92        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
93        ret.set_name(name);
94        ret.set_value(value);
95        ret
96    }
97    #[deprecated = "Use `set_domain()` instead."]
98    pub fn domain(&mut self, val: Option<&str>) -> &mut Self {
99        self.set_domain(val);
100        self
101    }
102    #[deprecated = "Use `set_expires()` instead."]
103    pub fn expires(&mut self, val: Option<f64>) -> &mut Self {
104        self.set_expires(val);
105        self
106    }
107    #[deprecated = "Use `set_name()` instead."]
108    pub fn name(&mut self, val: &str) -> &mut Self {
109        self.set_name(val);
110        self
111    }
112    #[deprecated = "Use `set_partitioned()` instead."]
113    pub fn partitioned(&mut self, val: bool) -> &mut Self {
114        self.set_partitioned(val);
115        self
116    }
117    #[deprecated = "Use `set_path()` instead."]
118    pub fn path(&mut self, val: &str) -> &mut Self {
119        self.set_path(val);
120        self
121    }
122    #[cfg(feature = "CookieSameSite")]
123    #[deprecated = "Use `set_same_site()` instead."]
124    pub fn same_site(&mut self, val: CookieSameSite) -> &mut Self {
125        self.set_same_site(val);
126        self
127    }
128    #[deprecated = "Use `set_value()` instead."]
129    pub fn value(&mut self, val: &str) -> &mut Self {
130        self.set_value(val);
131        self
132    }
133}