maxcountryman_web_sys/features/
gen_DnsCacheEntry.rs

1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = DnsCacheEntry)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `DnsCacheEntry` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"]
11    pub type DnsCacheEntry;
12}
13impl DnsCacheEntry {
14    #[doc = "Construct a new `DnsCacheEntry`."]
15    #[doc = ""]
16    #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"]
17    pub fn new() -> Self {
18        #[allow(unused_mut)]
19        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
20        ret
21    }
22    #[doc = "Change the `expiration` field of this object."]
23    #[doc = ""]
24    #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"]
25    pub fn expiration(&mut self, val: f64) -> &mut Self {
26        use wasm_bindgen::JsValue;
27        let r = ::js_sys::Reflect::set(
28            self.as_ref(),
29            &JsValue::from("expiration"),
30            &JsValue::from(val),
31        );
32        debug_assert!(
33            r.is_ok(),
34            "setting properties should never fail on our dictionary objects"
35        );
36        let _ = r;
37        self
38    }
39    #[doc = "Change the `family` field of this object."]
40    #[doc = ""]
41    #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"]
42    pub fn family(&mut self, val: &str) -> &mut Self {
43        use wasm_bindgen::JsValue;
44        let r =
45            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("family"), &JsValue::from(val));
46        debug_assert!(
47            r.is_ok(),
48            "setting properties should never fail on our dictionary objects"
49        );
50        let _ = r;
51        self
52    }
53    #[doc = "Change the `hostaddr` field of this object."]
54    #[doc = ""]
55    #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"]
56    pub fn hostaddr(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
57        use wasm_bindgen::JsValue;
58        let r = ::js_sys::Reflect::set(
59            self.as_ref(),
60            &JsValue::from("hostaddr"),
61            &JsValue::from(val),
62        );
63        debug_assert!(
64            r.is_ok(),
65            "setting properties should never fail on our dictionary objects"
66        );
67        let _ = r;
68        self
69    }
70    #[doc = "Change the `hostname` field of this object."]
71    #[doc = ""]
72    #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"]
73    pub fn hostname(&mut self, val: &str) -> &mut Self {
74        use wasm_bindgen::JsValue;
75        let r = ::js_sys::Reflect::set(
76            self.as_ref(),
77            &JsValue::from("hostname"),
78            &JsValue::from(val),
79        );
80        debug_assert!(
81            r.is_ok(),
82            "setting properties should never fail on our dictionary objects"
83        );
84        let _ = r;
85        self
86    }
87    #[doc = "Change the `trr` field of this object."]
88    #[doc = ""]
89    #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"]
90    pub fn trr(&mut self, val: bool) -> &mut Self {
91        use wasm_bindgen::JsValue;
92        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("trr"), &JsValue::from(val));
93        debug_assert!(
94            r.is_ok(),
95            "setting properties should never fail on our dictionary objects"
96        );
97        let _ = r;
98        self
99    }
100}
101impl Default for DnsCacheEntry {
102    fn default() -> Self {
103        Self::new()
104    }
105}