Skip to main content

web_sys/features/
gen_PublicKeyCredentialDescriptor.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    #[wasm_bindgen(
8        extends = "::js_sys::Object",
9        js_name = "PublicKeyCredentialDescriptor"
10    )]
11    #[derive(Debug, Clone, PartialEq, Eq)]
12    #[doc = "The `PublicKeyCredentialDescriptor` dictionary."]
13    #[doc = ""]
14    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"]
15    pub type PublicKeyCredentialDescriptor;
16    #[doc = "Get the `id` field of this object."]
17    #[doc = ""]
18    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"]
19    #[wasm_bindgen(method, getter = "id")]
20    pub fn get_id(this: &PublicKeyCredentialDescriptor) -> ::js_sys::Object;
21    #[doc = "Change the `id` field of this object."]
22    #[doc = ""]
23    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"]
24    #[wasm_bindgen(method, setter = "id")]
25    pub fn set_id(this: &PublicKeyCredentialDescriptor, val: &::js_sys::Object);
26    #[doc = "Change the `id` field of this object."]
27    #[doc = ""]
28    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"]
29    #[wasm_bindgen(method, setter = "id")]
30    pub fn set_id_buffer_source(this: &PublicKeyCredentialDescriptor, val: &::js_sys::Object);
31    #[doc = "Change the `id` field of this object."]
32    #[doc = ""]
33    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"]
34    #[wasm_bindgen(method, setter = "id")]
35    pub fn set_id_u8_slice(this: &PublicKeyCredentialDescriptor, val: &mut [u8]);
36    #[doc = "Change the `id` field of this object."]
37    #[doc = ""]
38    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"]
39    #[wasm_bindgen(method, setter = "id")]
40    pub fn set_id_u8_array(this: &PublicKeyCredentialDescriptor, val: &::js_sys::Uint8Array);
41    #[doc = "Get the `transports` field of this object."]
42    #[doc = ""]
43    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"]
44    #[wasm_bindgen(method, getter = "transports")]
45    pub fn get_transports(this: &PublicKeyCredentialDescriptor) -> Option<::js_sys::Array>;
46    #[doc = "Change the `transports` field of this object."]
47    #[doc = ""]
48    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"]
49    #[wasm_bindgen(method, setter = "transports")]
50    pub fn set_transports(this: &PublicKeyCredentialDescriptor, val: &::wasm_bindgen::JsValue);
51    #[cfg(feature = "PublicKeyCredentialType")]
52    #[doc = "Get the `type` field of this object."]
53    #[doc = ""]
54    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`, `PublicKeyCredentialType`*"]
55    #[wasm_bindgen(method, getter = "type")]
56    pub fn get_type(this: &PublicKeyCredentialDescriptor) -> PublicKeyCredentialType;
57    #[cfg(feature = "PublicKeyCredentialType")]
58    #[doc = "Change the `type` field of this object."]
59    #[doc = ""]
60    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`, `PublicKeyCredentialType`*"]
61    #[wasm_bindgen(method, setter = "type")]
62    pub fn set_type(this: &PublicKeyCredentialDescriptor, val: PublicKeyCredentialType);
63}
64impl PublicKeyCredentialDescriptor {
65    #[cfg(feature = "PublicKeyCredentialType")]
66    #[doc = "Construct a new `PublicKeyCredentialDescriptor`."]
67    #[doc = ""]
68    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`, `PublicKeyCredentialType`*"]
69    pub fn new(id: &::js_sys::Object, type_: PublicKeyCredentialType) -> Self {
70        #[allow(unused_mut)]
71        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
72        ret.set_id(id);
73        ret.set_type(type_);
74        ret
75    }
76    #[cfg(feature = "PublicKeyCredentialType")]
77    #[doc = "Construct a new `PublicKeyCredentialDescriptor`."]
78    #[doc = ""]
79    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`, `PublicKeyCredentialType`*"]
80    pub fn new_with_u8_slice(id: &mut [u8], type_: PublicKeyCredentialType) -> Self {
81        #[allow(unused_mut)]
82        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
83        ret.set_id_u8_slice(id);
84        ret.set_type(type_);
85        ret
86    }
87    #[cfg(feature = "PublicKeyCredentialType")]
88    #[doc = "Construct a new `PublicKeyCredentialDescriptor`."]
89    #[doc = ""]
90    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`, `PublicKeyCredentialType`*"]
91    pub fn new_with_u8_array(id: &::js_sys::Uint8Array, type_: PublicKeyCredentialType) -> Self {
92        #[allow(unused_mut)]
93        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
94        ret.set_id_u8_array(id);
95        ret.set_type(type_);
96        ret
97    }
98    #[deprecated = "Use `set_id()` instead."]
99    pub fn id(&mut self, val: &::js_sys::Object) -> &mut Self {
100        self.set_id(val);
101        self
102    }
103    #[deprecated = "Use `set_transports()` instead."]
104    pub fn transports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
105        self.set_transports(val);
106        self
107    }
108    #[cfg(feature = "PublicKeyCredentialType")]
109    #[deprecated = "Use `set_type()` instead."]
110    pub fn type_(&mut self, val: PublicKeyCredentialType) -> &mut Self {
111        self.set_type(val);
112        self
113    }
114}