maxcountryman_web_sys/features/
gen_HmacKeyAlgorithm.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 = HmacKeyAlgorithm)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `HmacKeyAlgorithm` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"]
11    pub type HmacKeyAlgorithm;
12}
13impl HmacKeyAlgorithm {
14    #[cfg(feature = "KeyAlgorithm")]
15    #[doc = "Construct a new `HmacKeyAlgorithm`."]
16    #[doc = ""]
17    #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`, `KeyAlgorithm`*"]
18    pub fn new(name: &str, hash: &KeyAlgorithm, length: u32) -> Self {
19        #[allow(unused_mut)]
20        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
21        ret.name(name);
22        ret.hash(hash);
23        ret.length(length);
24        ret
25    }
26    #[doc = "Change the `name` field of this object."]
27    #[doc = ""]
28    #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"]
29    pub fn name(&mut self, val: &str) -> &mut Self {
30        use wasm_bindgen::JsValue;
31        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val));
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    #[cfg(feature = "KeyAlgorithm")]
40    #[doc = "Change the `hash` field of this object."]
41    #[doc = ""]
42    #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`, `KeyAlgorithm`*"]
43    pub fn hash(&mut self, val: &KeyAlgorithm) -> &mut Self {
44        use wasm_bindgen::JsValue;
45        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("hash"), &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 `length` field of this object."]
54    #[doc = ""]
55    #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"]
56    pub fn length(&mut self, val: u32) -> &mut Self {
57        use wasm_bindgen::JsValue;
58        let r =
59            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("length"), &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}