maxcountryman_web_sys/features/
gen_HitRegionOptions.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 = HitRegionOptions)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `HitRegionOptions` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`*"]
11    pub type HitRegionOptions;
12}
13impl HitRegionOptions {
14    #[doc = "Construct a new `HitRegionOptions`."]
15    #[doc = ""]
16    #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`*"]
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    #[cfg(feature = "Element")]
23    #[doc = "Change the `control` field of this object."]
24    #[doc = ""]
25    #[doc = "*This API requires the following crate features to be activated: `Element`, `HitRegionOptions`*"]
26    pub fn control(&mut self, val: Option<&Element>) -> &mut Self {
27        use wasm_bindgen::JsValue;
28        let r = ::js_sys::Reflect::set(
29            self.as_ref(),
30            &JsValue::from("control"),
31            &JsValue::from(val),
32        );
33        debug_assert!(
34            r.is_ok(),
35            "setting properties should never fail on our dictionary objects"
36        );
37        let _ = r;
38        self
39    }
40    #[doc = "Change the `id` field of this object."]
41    #[doc = ""]
42    #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`*"]
43    pub fn id(&mut self, val: &str) -> &mut Self {
44        use wasm_bindgen::JsValue;
45        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &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    #[cfg(feature = "Path2d")]
54    #[doc = "Change the `path` field of this object."]
55    #[doc = ""]
56    #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`, `Path2d`*"]
57    pub fn path(&mut self, val: Option<&Path2d>) -> &mut Self {
58        use wasm_bindgen::JsValue;
59        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("path"), &JsValue::from(val));
60        debug_assert!(
61            r.is_ok(),
62            "setting properties should never fail on our dictionary objects"
63        );
64        let _ = r;
65        self
66    }
67}
68impl Default for HitRegionOptions {
69    fn default() -> Self {
70        Self::new()
71    }
72}