wiwi_wasm/object/
ns.rs

1// todo this file is incomplete
2
3use crate::prelude_internal::*;
4use super::raw;
5
6gen_struct! {
7	struct ExternObjectNs ExternObjectNsWithState;
8
9	deref ExternAny;
10	deref_value {
11		let value = raw::OBJECT.with(Clone::clone);
12		ExternAny::from_js_value(value)
13	};
14
15	field value ValueSlot;
16}
17
18gen_state! {
19	field Value;
20	init ValueInit;
21}
22
23gen_builder_fns! {
24	struct ExternObjectNsWithState;
25
26	state Value;
27	init ValueInit;
28	slot ValueSlot;
29
30	field value;
31}
32
33gen_call_fn! {
34	struct ExternObjectNsWithState;
35	raw_call {
36		todo!()
37	};
38	return ExternObject;
39
40	field value;
41	state Value;
42	init Uninit;
43}
44
45gen_call_fn! {
46	struct ExternObjectNsWithState;
47	raw_call {
48		let _ = value;
49		todo!()
50	};
51	// todo better return type
52	return ExternAny;
53
54	field value;
55	state Value;
56	init Init<ValueSlot, AnyMarker>;
57}
58
59gen_call_fn! {
60	struct ExternObjectNsWithState;
61	raw_call {
62		let _ = value;
63		todo!()
64	};
65	// todo better return type
66	return crate::ExternBigInt;
67
68	field value;
69	state Value;
70	init Init<ValueSlot, BigIntMarker>;
71}
72
73gen_call_fn! {
74	struct ExternObjectNsWithState;
75	raw_call {
76		let _ = value;
77		todo!()
78	};
79	// todo better return type
80	return crate::ExternBoolean;
81
82	field value;
83	state Value;
84	init Init<ValueSlot, BooleanMarker>;
85}
86
87gen_call_fn! {
88	struct ExternObjectNsWithState;
89	raw_call {
90		let _ = value;
91		todo!()
92	};
93	// todo better return type
94	return u8;
95
96	field value;
97	state Value;
98	init Init<ValueSlot, NumberMarker>;
99}
100
101gen_call_fn! {
102	struct ExternObjectNsWithState;
103	raw_call {
104		let _ = value;
105		todo!()
106	};
107	// todo better return type
108	return ExternAny;
109
110	field value;
111	state Value;
112	init Init<ValueSlot, ObjectMarker>;
113}
114
115gen_call_fn! {
116	struct ExternObjectNsWithState;
117	raw_call {
118		let _ = value;
119		todo!()
120	};
121	// todo better return type
122	return ExternAny;
123
124	field value;
125	state Value;
126	init Init<ValueSlot, StringMarker>;
127}
128
129gen_call_fn! {
130	struct ExternObjectNsWithState;
131	raw_call {
132		let _ = value;
133		todo!()
134	};
135	// todo better return type
136	return ExternAny;
137
138	field value;
139	state Value;
140	init Init<ValueSlot, SymbolMarker>;
141}
142
143gen_slot! {
144	slot ValueSlot;
145}
146
147gen_slot_impl! {
148	slot ValueSlot;
149	impl &'h ExternAny;
150
151	type_marker AnyMarker;
152	result &'h ExternAny;
153
154	simple_rw any;
155	autoderef;
156}
157
158gen_slot_impl! {
159	slot ValueSlot;
160	impl {
161		S: crate::bigint::State
162	} &'h crate::ExternBigIntWithState<'h, S>;
163
164	type_marker BigIntMarker;
165	result &'h crate::ExternAny;
166
167	simple_rw any;
168	autoderef;
169}
170
171gen_slot_impl! {
172	slot ValueSlot;
173	impl {
174		S: crate::boolean::State
175	} &'h crate::ExternBooleanWithState<'h, S>;
176
177	type_marker BooleanMarker;
178	result &'h crate::ExternAny;
179
180	simple_rw any;
181	autoderef;
182}
183
184gen_slot_impl! {
185	slot ValueSlot;
186	impl {
187		S: crate::number::State
188	} &'h crate::ExternNumberWithState<'h, S>;
189
190	type_marker NumberMarker;
191	result &'h crate::ExternAny;
192
193	simple_rw any;
194	autoderef;
195}
196
197// gen_slot_impl! {
198// 	slot ValueSlot;
199// 	impl {
200// 		S: crate::object::State
201// 	} &'h crate::ExternObjectWithState<'h, S>;
202//
203// 	type_marker ObjectMarker;
204// 	result &'h crate::ExternAny;
205//
206// 	simple_rw any;
207// 	autoderef;
208// }
209
210gen_slot_impl! {
211	slot ValueSlot;
212	impl {
213		S: crate::string::State
214	} &'h crate::ExternStringWithState<'h, S>;
215
216	type_marker StringMarker;
217	result &'h crate::ExternAny;
218
219	simple_rw any;
220	autoderef;
221}
222
223gen_slot_impl! {
224	slot ValueSlot;
225	impl {
226		S: crate::symbol::State
227	} &'h crate::ExternSymbolWithState<'h, S>;
228
229	type_marker SymbolMarker;
230	result &'h crate::ExternAny;
231
232	simple_rw any;
233	autoderef;
234}