3061444d8083f9bddfe60ac5e2d7baba28870ef8
[ldk-c-bindings] / lightning-c-bindings / src / lightning / ln / features.rs
1 // This file is Copyright its original authors, visible in version control
2 // history and in the source files from which this was generated.
3 //
4 // This file is licensed under the license available in the LICENSE or LICENSE.md
5 // file in the root of this repository or, if no such file exists, the same
6 // license as that which applies to the original source files from which this
7 // source was automatically generated.
8
9 //! Feature flag definitions for the Lightning protocol according to [BOLT #9].
10 //!
11 //! Lightning nodes advertise a supported set of operation through feature flags. Features are
12 //! applicable for a specific context as indicated in some [messages]. [`Features`] encapsulates
13 //! behavior for specifying and checking feature flags for a particular context. Each feature is
14 //! defined internally by a trait specifying the corresponding flags (i.e., even and odd bits).
15 //!
16 //! Whether a feature is considered \"known\" or \"unknown\" is relative to the implementation, whereas
17 //! the term \"supports\" is used in reference to a particular set of [`Features`]. That is, a node
18 //! supports a feature if it advertises the feature (as either required or optional) to its peers.
19 //! And the implementation can interpret a feature if the feature is known to it.
20 //!
21 //! [BOLT #9]: https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md
22 //! [messages]: crate::ln::msgs
23
24 use alloc::str::FromStr;
25 use core::ffi::c_void;
26 use core::convert::Infallible;
27 use bitcoin::hashes::Hash;
28 use crate::c_types::*;
29 #[cfg(feature="no-std")]
30 use alloc::{vec::Vec, boxed::Box};
31
32 mod sealed {
33
34 use alloc::str::FromStr;
35 use core::ffi::c_void;
36 use core::convert::Infallible;
37 use bitcoin::hashes::Hash;
38 use crate::c_types::*;
39 #[cfg(feature="no-std")]
40 use alloc::{vec::Vec, boxed::Box};
41
42 /// Set this feature as optional.
43 #[no_mangle]
44 pub extern "C" fn InitFeatures_set_data_loss_protect_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
45         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_data_loss_protect_optional()
46 }
47
48 /// Set this feature as required.
49 #[no_mangle]
50 pub extern "C" fn InitFeatures_set_data_loss_protect_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
51         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_data_loss_protect_required()
52 }
53
54 /// Checks if this feature is supported.
55 #[must_use]
56 #[no_mangle]
57 pub extern "C" fn InitFeatures_supports_data_loss_protect(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
58         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_data_loss_protect();
59         ret
60 }
61
62 /// Set this feature as optional.
63 #[no_mangle]
64 pub extern "C" fn NodeFeatures_set_data_loss_protect_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
65         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_data_loss_protect_optional()
66 }
67
68 /// Set this feature as required.
69 #[no_mangle]
70 pub extern "C" fn NodeFeatures_set_data_loss_protect_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
71         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_data_loss_protect_required()
72 }
73
74 /// Checks if this feature is supported.
75 #[must_use]
76 #[no_mangle]
77 pub extern "C" fn NodeFeatures_supports_data_loss_protect(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
78         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_data_loss_protect();
79         ret
80 }
81
82 /// Checks if this feature is required.
83 #[must_use]
84 #[no_mangle]
85 pub extern "C" fn InitFeatures_requires_data_loss_protect(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
86         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_data_loss_protect();
87         ret
88 }
89
90 /// Checks if this feature is required.
91 #[must_use]
92 #[no_mangle]
93 pub extern "C" fn NodeFeatures_requires_data_loss_protect(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
94         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_data_loss_protect();
95         ret
96 }
97
98 /// Set this feature as optional.
99 #[no_mangle]
100 pub extern "C" fn InitFeatures_set_initial_routing_sync_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
101         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_initial_routing_sync_optional()
102 }
103
104 /// Set this feature as required.
105 #[no_mangle]
106 pub extern "C" fn InitFeatures_set_initial_routing_sync_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
107         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_initial_routing_sync_required()
108 }
109
110 /// Checks if this feature is supported.
111 #[must_use]
112 #[no_mangle]
113 pub extern "C" fn InitFeatures_initial_routing_sync(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
114         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.initial_routing_sync();
115         ret
116 }
117
118 /// Set this feature as optional.
119 #[no_mangle]
120 pub extern "C" fn InitFeatures_set_upfront_shutdown_script_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
121         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_upfront_shutdown_script_optional()
122 }
123
124 /// Set this feature as required.
125 #[no_mangle]
126 pub extern "C" fn InitFeatures_set_upfront_shutdown_script_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
127         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_upfront_shutdown_script_required()
128 }
129
130 /// Checks if this feature is supported.
131 #[must_use]
132 #[no_mangle]
133 pub extern "C" fn InitFeatures_supports_upfront_shutdown_script(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
134         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_upfront_shutdown_script();
135         ret
136 }
137
138 /// Set this feature as optional.
139 #[no_mangle]
140 pub extern "C" fn NodeFeatures_set_upfront_shutdown_script_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
141         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_upfront_shutdown_script_optional()
142 }
143
144 /// Set this feature as required.
145 #[no_mangle]
146 pub extern "C" fn NodeFeatures_set_upfront_shutdown_script_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
147         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_upfront_shutdown_script_required()
148 }
149
150 /// Checks if this feature is supported.
151 #[must_use]
152 #[no_mangle]
153 pub extern "C" fn NodeFeatures_supports_upfront_shutdown_script(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
154         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_upfront_shutdown_script();
155         ret
156 }
157
158 /// Checks if this feature is required.
159 #[must_use]
160 #[no_mangle]
161 pub extern "C" fn InitFeatures_requires_upfront_shutdown_script(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
162         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_upfront_shutdown_script();
163         ret
164 }
165
166 /// Checks if this feature is required.
167 #[must_use]
168 #[no_mangle]
169 pub extern "C" fn NodeFeatures_requires_upfront_shutdown_script(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
170         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_upfront_shutdown_script();
171         ret
172 }
173
174 /// Set this feature as optional.
175 #[no_mangle]
176 pub extern "C" fn InitFeatures_set_gossip_queries_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
177         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_gossip_queries_optional()
178 }
179
180 /// Set this feature as required.
181 #[no_mangle]
182 pub extern "C" fn InitFeatures_set_gossip_queries_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
183         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_gossip_queries_required()
184 }
185
186 /// Checks if this feature is supported.
187 #[must_use]
188 #[no_mangle]
189 pub extern "C" fn InitFeatures_supports_gossip_queries(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
190         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_gossip_queries();
191         ret
192 }
193
194 /// Set this feature as optional.
195 #[no_mangle]
196 pub extern "C" fn NodeFeatures_set_gossip_queries_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
197         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_gossip_queries_optional()
198 }
199
200 /// Set this feature as required.
201 #[no_mangle]
202 pub extern "C" fn NodeFeatures_set_gossip_queries_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
203         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_gossip_queries_required()
204 }
205
206 /// Checks if this feature is supported.
207 #[must_use]
208 #[no_mangle]
209 pub extern "C" fn NodeFeatures_supports_gossip_queries(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
210         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_gossip_queries();
211         ret
212 }
213
214 /// Checks if this feature is required.
215 #[must_use]
216 #[no_mangle]
217 pub extern "C" fn InitFeatures_requires_gossip_queries(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
218         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_gossip_queries();
219         ret
220 }
221
222 /// Checks if this feature is required.
223 #[must_use]
224 #[no_mangle]
225 pub extern "C" fn NodeFeatures_requires_gossip_queries(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
226         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_gossip_queries();
227         ret
228 }
229
230 /// Set this feature as optional.
231 #[no_mangle]
232 pub extern "C" fn InitFeatures_set_variable_length_onion_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
233         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_variable_length_onion_optional()
234 }
235
236 /// Set this feature as required.
237 #[no_mangle]
238 pub extern "C" fn InitFeatures_set_variable_length_onion_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
239         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_variable_length_onion_required()
240 }
241
242 /// Checks if this feature is supported.
243 #[must_use]
244 #[no_mangle]
245 pub extern "C" fn InitFeatures_supports_variable_length_onion(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
246         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_variable_length_onion();
247         ret
248 }
249
250 /// Set this feature as optional.
251 #[no_mangle]
252 pub extern "C" fn NodeFeatures_set_variable_length_onion_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
253         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_variable_length_onion_optional()
254 }
255
256 /// Set this feature as required.
257 #[no_mangle]
258 pub extern "C" fn NodeFeatures_set_variable_length_onion_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
259         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_variable_length_onion_required()
260 }
261
262 /// Checks if this feature is supported.
263 #[must_use]
264 #[no_mangle]
265 pub extern "C" fn NodeFeatures_supports_variable_length_onion(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
266         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_variable_length_onion();
267         ret
268 }
269
270 /// Set this feature as optional.
271 #[no_mangle]
272 pub extern "C" fn InvoiceFeatures_set_variable_length_onion_optional(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) {
273         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_variable_length_onion_optional()
274 }
275
276 /// Set this feature as required.
277 #[no_mangle]
278 pub extern "C" fn InvoiceFeatures_set_variable_length_onion_required(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) {
279         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_variable_length_onion_required()
280 }
281
282 /// Checks if this feature is supported.
283 #[must_use]
284 #[no_mangle]
285 pub extern "C" fn InvoiceFeatures_supports_variable_length_onion(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
286         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_variable_length_onion();
287         ret
288 }
289
290 /// Checks if this feature is required.
291 #[must_use]
292 #[no_mangle]
293 pub extern "C" fn InitFeatures_requires_variable_length_onion(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
294         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_variable_length_onion();
295         ret
296 }
297
298 /// Checks if this feature is required.
299 #[must_use]
300 #[no_mangle]
301 pub extern "C" fn NodeFeatures_requires_variable_length_onion(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
302         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_variable_length_onion();
303         ret
304 }
305
306 /// Checks if this feature is required.
307 #[must_use]
308 #[no_mangle]
309 pub extern "C" fn InvoiceFeatures_requires_variable_length_onion(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
310         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_variable_length_onion();
311         ret
312 }
313
314 /// Set this feature as optional.
315 #[no_mangle]
316 pub extern "C" fn InitFeatures_set_static_remote_key_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
317         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_static_remote_key_optional()
318 }
319
320 /// Set this feature as required.
321 #[no_mangle]
322 pub extern "C" fn InitFeatures_set_static_remote_key_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
323         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_static_remote_key_required()
324 }
325
326 /// Checks if this feature is supported.
327 #[must_use]
328 #[no_mangle]
329 pub extern "C" fn InitFeatures_supports_static_remote_key(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
330         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_static_remote_key();
331         ret
332 }
333
334 /// Set this feature as optional.
335 #[no_mangle]
336 pub extern "C" fn NodeFeatures_set_static_remote_key_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
337         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_static_remote_key_optional()
338 }
339
340 /// Set this feature as required.
341 #[no_mangle]
342 pub extern "C" fn NodeFeatures_set_static_remote_key_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
343         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_static_remote_key_required()
344 }
345
346 /// Checks if this feature is supported.
347 #[must_use]
348 #[no_mangle]
349 pub extern "C" fn NodeFeatures_supports_static_remote_key(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
350         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_static_remote_key();
351         ret
352 }
353
354 /// Set this feature as optional.
355 #[no_mangle]
356 pub extern "C" fn ChannelTypeFeatures_set_static_remote_key_optional(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) {
357         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_static_remote_key_optional()
358 }
359
360 /// Set this feature as required.
361 #[no_mangle]
362 pub extern "C" fn ChannelTypeFeatures_set_static_remote_key_required(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) {
363         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_static_remote_key_required()
364 }
365
366 /// Checks if this feature is supported.
367 #[must_use]
368 #[no_mangle]
369 pub extern "C" fn ChannelTypeFeatures_supports_static_remote_key(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool {
370         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_static_remote_key();
371         ret
372 }
373
374 /// Checks if this feature is required.
375 #[must_use]
376 #[no_mangle]
377 pub extern "C" fn InitFeatures_requires_static_remote_key(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
378         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_static_remote_key();
379         ret
380 }
381
382 /// Checks if this feature is required.
383 #[must_use]
384 #[no_mangle]
385 pub extern "C" fn NodeFeatures_requires_static_remote_key(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
386         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_static_remote_key();
387         ret
388 }
389
390 /// Checks if this feature is required.
391 #[must_use]
392 #[no_mangle]
393 pub extern "C" fn ChannelTypeFeatures_requires_static_remote_key(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool {
394         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_static_remote_key();
395         ret
396 }
397
398 /// Set this feature as optional.
399 #[no_mangle]
400 pub extern "C" fn InitFeatures_set_payment_secret_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
401         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_payment_secret_optional()
402 }
403
404 /// Set this feature as required.
405 #[no_mangle]
406 pub extern "C" fn InitFeatures_set_payment_secret_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
407         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_payment_secret_required()
408 }
409
410 /// Checks if this feature is supported.
411 #[must_use]
412 #[no_mangle]
413 pub extern "C" fn InitFeatures_supports_payment_secret(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
414         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret();
415         ret
416 }
417
418 /// Set this feature as optional.
419 #[no_mangle]
420 pub extern "C" fn NodeFeatures_set_payment_secret_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
421         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_payment_secret_optional()
422 }
423
424 /// Set this feature as required.
425 #[no_mangle]
426 pub extern "C" fn NodeFeatures_set_payment_secret_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
427         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_payment_secret_required()
428 }
429
430 /// Checks if this feature is supported.
431 #[must_use]
432 #[no_mangle]
433 pub extern "C" fn NodeFeatures_supports_payment_secret(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
434         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret();
435         ret
436 }
437
438 /// Set this feature as optional.
439 #[no_mangle]
440 pub extern "C" fn InvoiceFeatures_set_payment_secret_optional(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) {
441         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_payment_secret_optional()
442 }
443
444 /// Set this feature as required.
445 #[no_mangle]
446 pub extern "C" fn InvoiceFeatures_set_payment_secret_required(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) {
447         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_payment_secret_required()
448 }
449
450 /// Checks if this feature is supported.
451 #[must_use]
452 #[no_mangle]
453 pub extern "C" fn InvoiceFeatures_supports_payment_secret(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
454         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret();
455         ret
456 }
457
458 /// Checks if this feature is required.
459 #[must_use]
460 #[no_mangle]
461 pub extern "C" fn InitFeatures_requires_payment_secret(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
462         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_payment_secret();
463         ret
464 }
465
466 /// Checks if this feature is required.
467 #[must_use]
468 #[no_mangle]
469 pub extern "C" fn NodeFeatures_requires_payment_secret(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
470         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_payment_secret();
471         ret
472 }
473
474 /// Checks if this feature is required.
475 #[must_use]
476 #[no_mangle]
477 pub extern "C" fn InvoiceFeatures_requires_payment_secret(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
478         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_payment_secret();
479         ret
480 }
481
482 /// Set this feature as optional.
483 #[no_mangle]
484 pub extern "C" fn InitFeatures_set_basic_mpp_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
485         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_basic_mpp_optional()
486 }
487
488 /// Set this feature as required.
489 #[no_mangle]
490 pub extern "C" fn InitFeatures_set_basic_mpp_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
491         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_basic_mpp_required()
492 }
493
494 /// Checks if this feature is supported.
495 #[must_use]
496 #[no_mangle]
497 pub extern "C" fn InitFeatures_supports_basic_mpp(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
498         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_basic_mpp();
499         ret
500 }
501
502 /// Set this feature as optional.
503 #[no_mangle]
504 pub extern "C" fn NodeFeatures_set_basic_mpp_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
505         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_basic_mpp_optional()
506 }
507
508 /// Set this feature as required.
509 #[no_mangle]
510 pub extern "C" fn NodeFeatures_set_basic_mpp_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
511         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_basic_mpp_required()
512 }
513
514 /// Checks if this feature is supported.
515 #[must_use]
516 #[no_mangle]
517 pub extern "C" fn NodeFeatures_supports_basic_mpp(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
518         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_basic_mpp();
519         ret
520 }
521
522 /// Set this feature as optional.
523 #[no_mangle]
524 pub extern "C" fn InvoiceFeatures_set_basic_mpp_optional(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) {
525         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_basic_mpp_optional()
526 }
527
528 /// Set this feature as required.
529 #[no_mangle]
530 pub extern "C" fn InvoiceFeatures_set_basic_mpp_required(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) {
531         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_basic_mpp_required()
532 }
533
534 /// Checks if this feature is supported.
535 #[must_use]
536 #[no_mangle]
537 pub extern "C" fn InvoiceFeatures_supports_basic_mpp(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
538         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_basic_mpp();
539         ret
540 }
541
542 /// Checks if this feature is required.
543 #[must_use]
544 #[no_mangle]
545 pub extern "C" fn InitFeatures_requires_basic_mpp(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
546         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_basic_mpp();
547         ret
548 }
549
550 /// Checks if this feature is required.
551 #[must_use]
552 #[no_mangle]
553 pub extern "C" fn NodeFeatures_requires_basic_mpp(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
554         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_basic_mpp();
555         ret
556 }
557
558 /// Checks if this feature is required.
559 #[must_use]
560 #[no_mangle]
561 pub extern "C" fn InvoiceFeatures_requires_basic_mpp(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
562         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_basic_mpp();
563         ret
564 }
565
566 /// Set this feature as optional.
567 #[no_mangle]
568 pub extern "C" fn InitFeatures_set_shutdown_any_segwit_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
569         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_shutdown_any_segwit_optional()
570 }
571
572 /// Set this feature as required.
573 #[no_mangle]
574 pub extern "C" fn InitFeatures_set_shutdown_any_segwit_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
575         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_shutdown_any_segwit_required()
576 }
577
578 /// Checks if this feature is supported.
579 #[must_use]
580 #[no_mangle]
581 pub extern "C" fn InitFeatures_supports_shutdown_anysegwit(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
582         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_shutdown_anysegwit();
583         ret
584 }
585
586 /// Set this feature as optional.
587 #[no_mangle]
588 pub extern "C" fn NodeFeatures_set_shutdown_any_segwit_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
589         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_shutdown_any_segwit_optional()
590 }
591
592 /// Set this feature as required.
593 #[no_mangle]
594 pub extern "C" fn NodeFeatures_set_shutdown_any_segwit_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
595         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_shutdown_any_segwit_required()
596 }
597
598 /// Checks if this feature is supported.
599 #[must_use]
600 #[no_mangle]
601 pub extern "C" fn NodeFeatures_supports_shutdown_anysegwit(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
602         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_shutdown_anysegwit();
603         ret
604 }
605
606 /// Checks if this feature is required.
607 #[must_use]
608 #[no_mangle]
609 pub extern "C" fn InitFeatures_requires_shutdown_anysegwit(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
610         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_shutdown_anysegwit();
611         ret
612 }
613
614 /// Checks if this feature is required.
615 #[must_use]
616 #[no_mangle]
617 pub extern "C" fn NodeFeatures_requires_shutdown_anysegwit(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
618         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_shutdown_anysegwit();
619         ret
620 }
621
622 /// Set this feature as optional.
623 #[no_mangle]
624 pub extern "C" fn InitFeatures_set_channel_type_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
625         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_channel_type_optional()
626 }
627
628 /// Set this feature as required.
629 #[no_mangle]
630 pub extern "C" fn InitFeatures_set_channel_type_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
631         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_channel_type_required()
632 }
633
634 /// Checks if this feature is supported.
635 #[must_use]
636 #[no_mangle]
637 pub extern "C" fn InitFeatures_supports_channel_type(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
638         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_channel_type();
639         ret
640 }
641
642 /// Set this feature as optional.
643 #[no_mangle]
644 pub extern "C" fn NodeFeatures_set_channel_type_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
645         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_channel_type_optional()
646 }
647
648 /// Set this feature as required.
649 #[no_mangle]
650 pub extern "C" fn NodeFeatures_set_channel_type_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
651         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_channel_type_required()
652 }
653
654 /// Checks if this feature is supported.
655 #[must_use]
656 #[no_mangle]
657 pub extern "C" fn NodeFeatures_supports_channel_type(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
658         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_channel_type();
659         ret
660 }
661
662 /// Checks if this feature is required.
663 #[must_use]
664 #[no_mangle]
665 pub extern "C" fn InitFeatures_requires_channel_type(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
666         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_channel_type();
667         ret
668 }
669
670 /// Checks if this feature is required.
671 #[must_use]
672 #[no_mangle]
673 pub extern "C" fn NodeFeatures_requires_channel_type(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
674         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_channel_type();
675         ret
676 }
677
678 /// Set this feature as optional.
679 #[no_mangle]
680 pub extern "C" fn InitFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
681         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_scid_privacy_optional()
682 }
683
684 /// Set this feature as required.
685 #[no_mangle]
686 pub extern "C" fn InitFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
687         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_scid_privacy_required()
688 }
689
690 /// Checks if this feature is supported.
691 #[must_use]
692 #[no_mangle]
693 pub extern "C" fn InitFeatures_supports_scid_privacy(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
694         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy();
695         ret
696 }
697
698 /// Set this feature as optional.
699 #[no_mangle]
700 pub extern "C" fn NodeFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
701         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_scid_privacy_optional()
702 }
703
704 /// Set this feature as required.
705 #[no_mangle]
706 pub extern "C" fn NodeFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
707         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_scid_privacy_required()
708 }
709
710 /// Checks if this feature is supported.
711 #[must_use]
712 #[no_mangle]
713 pub extern "C" fn NodeFeatures_supports_scid_privacy(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
714         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy();
715         ret
716 }
717
718 /// Set this feature as optional.
719 #[no_mangle]
720 pub extern "C" fn ChannelTypeFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) {
721         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_scid_privacy_optional()
722 }
723
724 /// Set this feature as required.
725 #[no_mangle]
726 pub extern "C" fn ChannelTypeFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) {
727         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_scid_privacy_required()
728 }
729
730 /// Checks if this feature is supported.
731 #[must_use]
732 #[no_mangle]
733 pub extern "C" fn ChannelTypeFeatures_supports_scid_privacy(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool {
734         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy();
735         ret
736 }
737
738 /// Checks if this feature is required.
739 #[must_use]
740 #[no_mangle]
741 pub extern "C" fn InitFeatures_requires_scid_privacy(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
742         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy();
743         ret
744 }
745
746 /// Checks if this feature is required.
747 #[must_use]
748 #[no_mangle]
749 pub extern "C" fn NodeFeatures_requires_scid_privacy(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
750         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy();
751         ret
752 }
753
754 /// Checks if this feature is required.
755 #[must_use]
756 #[no_mangle]
757 pub extern "C" fn ChannelTypeFeatures_requires_scid_privacy(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool {
758         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy();
759         ret
760 }
761
762 /// Set this feature as optional.
763 #[no_mangle]
764 pub extern "C" fn NodeFeatures_set_keysend_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
765         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_keysend_optional()
766 }
767
768 /// Set this feature as required.
769 #[no_mangle]
770 pub extern "C" fn NodeFeatures_set_keysend_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
771         unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_keysend_required()
772 }
773
774 /// Checks if this feature is supported.
775 #[must_use]
776 #[no_mangle]
777 pub extern "C" fn NodeFeatures_supports_keysend(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
778         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_keysend();
779         ret
780 }
781
782 /// Checks if this feature is required.
783 #[must_use]
784 #[no_mangle]
785 pub extern "C" fn NodeFeatures_requires_keysend(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
786         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_keysend();
787         ret
788 }
789
790 }
791 /// Checks if two InitFeaturess contain equal inner contents.
792 /// This ignores pointers and is_owned flags and looks at the values in fields.
793 /// Two objects with NULL inner values will be considered "equal" here.
794 #[no_mangle]
795 pub extern "C" fn InitFeatures_eq(a: &InitFeatures, b: &InitFeatures) -> bool {
796         if a.inner == b.inner { return true; }
797         if a.inner.is_null() || b.inner.is_null() { return false; }
798         if a.get_native_ref() == b.get_native_ref() { true } else { false }
799 }
800 /// Checks if two NodeFeaturess contain equal inner contents.
801 /// This ignores pointers and is_owned flags and looks at the values in fields.
802 /// Two objects with NULL inner values will be considered "equal" here.
803 #[no_mangle]
804 pub extern "C" fn NodeFeatures_eq(a: &NodeFeatures, b: &NodeFeatures) -> bool {
805         if a.inner == b.inner { return true; }
806         if a.inner.is_null() || b.inner.is_null() { return false; }
807         if a.get_native_ref() == b.get_native_ref() { true } else { false }
808 }
809 /// Checks if two ChannelFeaturess contain equal inner contents.
810 /// This ignores pointers and is_owned flags and looks at the values in fields.
811 /// Two objects with NULL inner values will be considered "equal" here.
812 #[no_mangle]
813 pub extern "C" fn ChannelFeatures_eq(a: &ChannelFeatures, b: &ChannelFeatures) -> bool {
814         if a.inner == b.inner { return true; }
815         if a.inner.is_null() || b.inner.is_null() { return false; }
816         if a.get_native_ref() == b.get_native_ref() { true } else { false }
817 }
818 /// Checks if two InvoiceFeaturess contain equal inner contents.
819 /// This ignores pointers and is_owned flags and looks at the values in fields.
820 /// Two objects with NULL inner values will be considered "equal" here.
821 #[no_mangle]
822 pub extern "C" fn InvoiceFeatures_eq(a: &InvoiceFeatures, b: &InvoiceFeatures) -> bool {
823         if a.inner == b.inner { return true; }
824         if a.inner.is_null() || b.inner.is_null() { return false; }
825         if a.get_native_ref() == b.get_native_ref() { true } else { false }
826 }
827 /// Checks if two ChannelTypeFeaturess contain equal inner contents.
828 /// This ignores pointers and is_owned flags and looks at the values in fields.
829 /// Two objects with NULL inner values will be considered "equal" here.
830 #[no_mangle]
831 pub extern "C" fn ChannelTypeFeatures_eq(a: &ChannelTypeFeatures, b: &ChannelTypeFeatures) -> bool {
832         if a.inner == b.inner { return true; }
833         if a.inner.is_null() || b.inner.is_null() { return false; }
834         if a.get_native_ref() == b.get_native_ref() { true } else { false }
835 }
836 impl Clone for InitFeatures {
837         fn clone(&self) -> Self {
838                 Self {
839                         inner: if <*mut nativeInitFeatures>::is_null(self.inner) { core::ptr::null_mut() } else {
840                                 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
841                         is_owned: true,
842                 }
843         }
844 }
845 #[allow(unused)]
846 /// Used only if an object of this type is returned as a trait impl by a method
847 pub(crate) extern "C" fn InitFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
848         Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInitFeatures)).clone() })) as *mut c_void
849 }
850 #[no_mangle]
851 /// Creates a copy of the InitFeatures
852 pub extern "C" fn InitFeatures_clone(orig: &InitFeatures) -> InitFeatures {
853         orig.clone()
854 }
855 impl Clone for NodeFeatures {
856         fn clone(&self) -> Self {
857                 Self {
858                         inner: if <*mut nativeNodeFeatures>::is_null(self.inner) { core::ptr::null_mut() } else {
859                                 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
860                         is_owned: true,
861                 }
862         }
863 }
864 #[allow(unused)]
865 /// Used only if an object of this type is returned as a trait impl by a method
866 pub(crate) extern "C" fn NodeFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
867         Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeFeatures)).clone() })) as *mut c_void
868 }
869 #[no_mangle]
870 /// Creates a copy of the NodeFeatures
871 pub extern "C" fn NodeFeatures_clone(orig: &NodeFeatures) -> NodeFeatures {
872         orig.clone()
873 }
874 impl Clone for ChannelFeatures {
875         fn clone(&self) -> Self {
876                 Self {
877                         inner: if <*mut nativeChannelFeatures>::is_null(self.inner) { core::ptr::null_mut() } else {
878                                 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
879                         is_owned: true,
880                 }
881         }
882 }
883 #[allow(unused)]
884 /// Used only if an object of this type is returned as a trait impl by a method
885 pub(crate) extern "C" fn ChannelFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
886         Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelFeatures)).clone() })) as *mut c_void
887 }
888 #[no_mangle]
889 /// Creates a copy of the ChannelFeatures
890 pub extern "C" fn ChannelFeatures_clone(orig: &ChannelFeatures) -> ChannelFeatures {
891         orig.clone()
892 }
893 impl Clone for InvoiceFeatures {
894         fn clone(&self) -> Self {
895                 Self {
896                         inner: if <*mut nativeInvoiceFeatures>::is_null(self.inner) { core::ptr::null_mut() } else {
897                                 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
898                         is_owned: true,
899                 }
900         }
901 }
902 #[allow(unused)]
903 /// Used only if an object of this type is returned as a trait impl by a method
904 pub(crate) extern "C" fn InvoiceFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
905         Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInvoiceFeatures)).clone() })) as *mut c_void
906 }
907 #[no_mangle]
908 /// Creates a copy of the InvoiceFeatures
909 pub extern "C" fn InvoiceFeatures_clone(orig: &InvoiceFeatures) -> InvoiceFeatures {
910         orig.clone()
911 }
912 impl Clone for ChannelTypeFeatures {
913         fn clone(&self) -> Self {
914                 Self {
915                         inner: if <*mut nativeChannelTypeFeatures>::is_null(self.inner) { core::ptr::null_mut() } else {
916                                 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
917                         is_owned: true,
918                 }
919         }
920 }
921 #[allow(unused)]
922 /// Used only if an object of this type is returned as a trait impl by a method
923 pub(crate) extern "C" fn ChannelTypeFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
924         Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelTypeFeatures)).clone() })) as *mut c_void
925 }
926 #[no_mangle]
927 /// Creates a copy of the ChannelTypeFeatures
928 pub extern "C" fn ChannelTypeFeatures_clone(orig: &ChannelTypeFeatures) -> ChannelTypeFeatures {
929         orig.clone()
930 }
931
932 use lightning::ln::features::InitFeatures as nativeInitFeaturesImport;
933 pub(crate) type nativeInitFeatures = nativeInitFeaturesImport;
934
935 /// Features used within an `init` message.
936 #[must_use]
937 #[repr(C)]
938 pub struct InitFeatures {
939         /// A pointer to the opaque Rust object.
940
941         /// Nearly everywhere, inner must be non-null, however in places where
942         /// the Rust equivalent takes an Option, it may be set to null to indicate None.
943         pub inner: *mut nativeInitFeatures,
944         /// Indicates that this is the only struct which contains the same pointer.
945
946         /// Rust functions which take ownership of an object provided via an argument require
947         /// this to be true and invalidate the object pointed to by inner.
948         pub is_owned: bool,
949 }
950
951 impl Drop for InitFeatures {
952         fn drop(&mut self) {
953                 if self.is_owned && !<*mut nativeInitFeatures>::is_null(self.inner) {
954                         let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
955                 }
956         }
957 }
958 /// Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
959 #[no_mangle]
960 pub extern "C" fn InitFeatures_free(this_obj: InitFeatures) { }
961 #[allow(unused)]
962 /// Used only if an object of this type is returned as a trait impl by a method
963 pub(crate) extern "C" fn InitFeatures_free_void(this_ptr: *mut c_void) {
964         unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInitFeatures); }
965 }
966 #[allow(unused)]
967 impl InitFeatures {
968         pub(crate) fn get_native_ref(&self) -> &'static nativeInitFeatures {
969                 unsafe { &*ObjOps::untweak_ptr(self.inner) }
970         }
971         pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInitFeatures {
972                 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
973         }
974         /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
975         pub(crate) fn take_inner(mut self) -> *mut nativeInitFeatures {
976                 assert!(self.is_owned);
977                 let ret = ObjOps::untweak_ptr(self.inner);
978                 self.inner = core::ptr::null_mut();
979                 ret
980         }
981 }
982
983 use lightning::ln::features::NodeFeatures as nativeNodeFeaturesImport;
984 pub(crate) type nativeNodeFeatures = nativeNodeFeaturesImport;
985
986 /// Features used within a `node_announcement` message.
987 #[must_use]
988 #[repr(C)]
989 pub struct NodeFeatures {
990         /// A pointer to the opaque Rust object.
991
992         /// Nearly everywhere, inner must be non-null, however in places where
993         /// the Rust equivalent takes an Option, it may be set to null to indicate None.
994         pub inner: *mut nativeNodeFeatures,
995         /// Indicates that this is the only struct which contains the same pointer.
996
997         /// Rust functions which take ownership of an object provided via an argument require
998         /// this to be true and invalidate the object pointed to by inner.
999         pub is_owned: bool,
1000 }
1001
1002 impl Drop for NodeFeatures {
1003         fn drop(&mut self) {
1004                 if self.is_owned && !<*mut nativeNodeFeatures>::is_null(self.inner) {
1005                         let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
1006                 }
1007         }
1008 }
1009 /// Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
1010 #[no_mangle]
1011 pub extern "C" fn NodeFeatures_free(this_obj: NodeFeatures) { }
1012 #[allow(unused)]
1013 /// Used only if an object of this type is returned as a trait impl by a method
1014 pub(crate) extern "C" fn NodeFeatures_free_void(this_ptr: *mut c_void) {
1015         unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeFeatures); }
1016 }
1017 #[allow(unused)]
1018 impl NodeFeatures {
1019         pub(crate) fn get_native_ref(&self) -> &'static nativeNodeFeatures {
1020                 unsafe { &*ObjOps::untweak_ptr(self.inner) }
1021         }
1022         pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNodeFeatures {
1023                 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
1024         }
1025         /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1026         pub(crate) fn take_inner(mut self) -> *mut nativeNodeFeatures {
1027                 assert!(self.is_owned);
1028                 let ret = ObjOps::untweak_ptr(self.inner);
1029                 self.inner = core::ptr::null_mut();
1030                 ret
1031         }
1032 }
1033
1034 use lightning::ln::features::ChannelFeatures as nativeChannelFeaturesImport;
1035 pub(crate) type nativeChannelFeatures = nativeChannelFeaturesImport;
1036
1037 /// Features used within a `channel_announcement` message.
1038 #[must_use]
1039 #[repr(C)]
1040 pub struct ChannelFeatures {
1041         /// A pointer to the opaque Rust object.
1042
1043         /// Nearly everywhere, inner must be non-null, however in places where
1044         /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1045         pub inner: *mut nativeChannelFeatures,
1046         /// Indicates that this is the only struct which contains the same pointer.
1047
1048         /// Rust functions which take ownership of an object provided via an argument require
1049         /// this to be true and invalidate the object pointed to by inner.
1050         pub is_owned: bool,
1051 }
1052
1053 impl Drop for ChannelFeatures {
1054         fn drop(&mut self) {
1055                 if self.is_owned && !<*mut nativeChannelFeatures>::is_null(self.inner) {
1056                         let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
1057                 }
1058         }
1059 }
1060 /// Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
1061 #[no_mangle]
1062 pub extern "C" fn ChannelFeatures_free(this_obj: ChannelFeatures) { }
1063 #[allow(unused)]
1064 /// Used only if an object of this type is returned as a trait impl by a method
1065 pub(crate) extern "C" fn ChannelFeatures_free_void(this_ptr: *mut c_void) {
1066         unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelFeatures); }
1067 }
1068 #[allow(unused)]
1069 impl ChannelFeatures {
1070         pub(crate) fn get_native_ref(&self) -> &'static nativeChannelFeatures {
1071                 unsafe { &*ObjOps::untweak_ptr(self.inner) }
1072         }
1073         pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelFeatures {
1074                 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
1075         }
1076         /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1077         pub(crate) fn take_inner(mut self) -> *mut nativeChannelFeatures {
1078                 assert!(self.is_owned);
1079                 let ret = ObjOps::untweak_ptr(self.inner);
1080                 self.inner = core::ptr::null_mut();
1081                 ret
1082         }
1083 }
1084
1085 use lightning::ln::features::InvoiceFeatures as nativeInvoiceFeaturesImport;
1086 pub(crate) type nativeInvoiceFeatures = nativeInvoiceFeaturesImport;
1087
1088 /// Features used within an invoice.
1089 #[must_use]
1090 #[repr(C)]
1091 pub struct InvoiceFeatures {
1092         /// A pointer to the opaque Rust object.
1093
1094         /// Nearly everywhere, inner must be non-null, however in places where
1095         /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1096         pub inner: *mut nativeInvoiceFeatures,
1097         /// Indicates that this is the only struct which contains the same pointer.
1098
1099         /// Rust functions which take ownership of an object provided via an argument require
1100         /// this to be true and invalidate the object pointed to by inner.
1101         pub is_owned: bool,
1102 }
1103
1104 impl Drop for InvoiceFeatures {
1105         fn drop(&mut self) {
1106                 if self.is_owned && !<*mut nativeInvoiceFeatures>::is_null(self.inner) {
1107                         let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
1108                 }
1109         }
1110 }
1111 /// Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
1112 #[no_mangle]
1113 pub extern "C" fn InvoiceFeatures_free(this_obj: InvoiceFeatures) { }
1114 #[allow(unused)]
1115 /// Used only if an object of this type is returned as a trait impl by a method
1116 pub(crate) extern "C" fn InvoiceFeatures_free_void(this_ptr: *mut c_void) {
1117         unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvoiceFeatures); }
1118 }
1119 #[allow(unused)]
1120 impl InvoiceFeatures {
1121         pub(crate) fn get_native_ref(&self) -> &'static nativeInvoiceFeatures {
1122                 unsafe { &*ObjOps::untweak_ptr(self.inner) }
1123         }
1124         pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInvoiceFeatures {
1125                 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
1126         }
1127         /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1128         pub(crate) fn take_inner(mut self) -> *mut nativeInvoiceFeatures {
1129                 assert!(self.is_owned);
1130                 let ret = ObjOps::untweak_ptr(self.inner);
1131                 self.inner = core::ptr::null_mut();
1132                 ret
1133         }
1134 }
1135
1136 use lightning::ln::features::ChannelTypeFeatures as nativeChannelTypeFeaturesImport;
1137 pub(crate) type nativeChannelTypeFeatures = nativeChannelTypeFeaturesImport;
1138
1139 /// Features used within the channel_type field in an OpenChannel message.
1140 ///
1141 /// A channel is always of some known \"type\", describing the transaction formats used and the exact
1142 /// semantics of our interaction with our peer.
1143 ///
1144 /// Note that because a channel is a specific type which is proposed by the opener and accepted by
1145 /// the counterparty, only required features are allowed here.
1146 ///
1147 /// This is serialized differently from other feature types - it is not prefixed by a length, and
1148 /// thus must only appear inside a TLV where its length is known in advance.
1149 #[must_use]
1150 #[repr(C)]
1151 pub struct ChannelTypeFeatures {
1152         /// A pointer to the opaque Rust object.
1153
1154         /// Nearly everywhere, inner must be non-null, however in places where
1155         /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1156         pub inner: *mut nativeChannelTypeFeatures,
1157         /// Indicates that this is the only struct which contains the same pointer.
1158
1159         /// Rust functions which take ownership of an object provided via an argument require
1160         /// this to be true and invalidate the object pointed to by inner.
1161         pub is_owned: bool,
1162 }
1163
1164 impl Drop for ChannelTypeFeatures {
1165         fn drop(&mut self) {
1166                 if self.is_owned && !<*mut nativeChannelTypeFeatures>::is_null(self.inner) {
1167                         let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
1168                 }
1169         }
1170 }
1171 /// Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
1172 #[no_mangle]
1173 pub extern "C" fn ChannelTypeFeatures_free(this_obj: ChannelTypeFeatures) { }
1174 #[allow(unused)]
1175 /// Used only if an object of this type is returned as a trait impl by a method
1176 pub(crate) extern "C" fn ChannelTypeFeatures_free_void(this_ptr: *mut c_void) {
1177         unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelTypeFeatures); }
1178 }
1179 #[allow(unused)]
1180 impl ChannelTypeFeatures {
1181         pub(crate) fn get_native_ref(&self) -> &'static nativeChannelTypeFeatures {
1182                 unsafe { &*ObjOps::untweak_ptr(self.inner) }
1183         }
1184         pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelTypeFeatures {
1185                 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
1186         }
1187         /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1188         pub(crate) fn take_inner(mut self) -> *mut nativeChannelTypeFeatures {
1189                 assert!(self.is_owned);
1190                 let ret = ObjOps::untweak_ptr(self.inner);
1191                 self.inner = core::ptr::null_mut();
1192                 ret
1193         }
1194 }
1195 /// Create a blank Features with no features set
1196 #[must_use]
1197 #[no_mangle]
1198 pub extern "C" fn InitFeatures_empty() -> crate::lightning::ln::features::InitFeatures {
1199         let mut ret = lightning::ln::features::InitFeatures::empty();
1200         crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1201 }
1202
1203 /// Creates a Features with the bits set which are known by the implementation
1204 #[must_use]
1205 #[no_mangle]
1206 pub extern "C" fn InitFeatures_known() -> crate::lightning::ln::features::InitFeatures {
1207         let mut ret = lightning::ln::features::InitFeatures::known();
1208         crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1209 }
1210
1211 /// Returns true if this `Features` object contains unknown feature flags which are set as
1212 /// \"required\".
1213 #[must_use]
1214 #[no_mangle]
1215 pub extern "C" fn InitFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
1216         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
1217         ret
1218 }
1219
1220 /// Create a blank Features with no features set
1221 #[must_use]
1222 #[no_mangle]
1223 pub extern "C" fn NodeFeatures_empty() -> crate::lightning::ln::features::NodeFeatures {
1224         let mut ret = lightning::ln::features::NodeFeatures::empty();
1225         crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1226 }
1227
1228 /// Creates a Features with the bits set which are known by the implementation
1229 #[must_use]
1230 #[no_mangle]
1231 pub extern "C" fn NodeFeatures_known() -> crate::lightning::ln::features::NodeFeatures {
1232         let mut ret = lightning::ln::features::NodeFeatures::known();
1233         crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1234 }
1235
1236 /// Returns true if this `Features` object contains unknown feature flags which are set as
1237 /// \"required\".
1238 #[must_use]
1239 #[no_mangle]
1240 pub extern "C" fn NodeFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
1241         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
1242         ret
1243 }
1244
1245 /// Create a blank Features with no features set
1246 #[must_use]
1247 #[no_mangle]
1248 pub extern "C" fn ChannelFeatures_empty() -> crate::lightning::ln::features::ChannelFeatures {
1249         let mut ret = lightning::ln::features::ChannelFeatures::empty();
1250         crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1251 }
1252
1253 /// Creates a Features with the bits set which are known by the implementation
1254 #[must_use]
1255 #[no_mangle]
1256 pub extern "C" fn ChannelFeatures_known() -> crate::lightning::ln::features::ChannelFeatures {
1257         let mut ret = lightning::ln::features::ChannelFeatures::known();
1258         crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1259 }
1260
1261 /// Returns true if this `Features` object contains unknown feature flags which are set as
1262 /// \"required\".
1263 #[must_use]
1264 #[no_mangle]
1265 pub extern "C" fn ChannelFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::ChannelFeatures) -> bool {
1266         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
1267         ret
1268 }
1269
1270 /// Create a blank Features with no features set
1271 #[must_use]
1272 #[no_mangle]
1273 pub extern "C" fn InvoiceFeatures_empty() -> crate::lightning::ln::features::InvoiceFeatures {
1274         let mut ret = lightning::ln::features::InvoiceFeatures::empty();
1275         crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1276 }
1277
1278 /// Creates a Features with the bits set which are known by the implementation
1279 #[must_use]
1280 #[no_mangle]
1281 pub extern "C" fn InvoiceFeatures_known() -> crate::lightning::ln::features::InvoiceFeatures {
1282         let mut ret = lightning::ln::features::InvoiceFeatures::known();
1283         crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1284 }
1285
1286 /// Returns true if this `Features` object contains unknown feature flags which are set as
1287 /// \"required\".
1288 #[must_use]
1289 #[no_mangle]
1290 pub extern "C" fn InvoiceFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
1291         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
1292         ret
1293 }
1294
1295 /// Create a blank Features with no features set
1296 #[must_use]
1297 #[no_mangle]
1298 pub extern "C" fn ChannelTypeFeatures_empty() -> crate::lightning::ln::features::ChannelTypeFeatures {
1299         let mut ret = lightning::ln::features::ChannelTypeFeatures::empty();
1300         crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1301 }
1302
1303 /// Creates a Features with the bits set which are known by the implementation
1304 #[must_use]
1305 #[no_mangle]
1306 pub extern "C" fn ChannelTypeFeatures_known() -> crate::lightning::ln::features::ChannelTypeFeatures {
1307         let mut ret = lightning::ln::features::ChannelTypeFeatures::known();
1308         crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1309 }
1310
1311 /// Returns true if this `Features` object contains unknown feature flags which are set as
1312 /// \"required\".
1313 #[must_use]
1314 #[no_mangle]
1315 pub extern "C" fn ChannelTypeFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool {
1316         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
1317         ret
1318 }
1319
1320 #[no_mangle]
1321 /// Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
1322 pub extern "C" fn InitFeatures_write(obj: &crate::lightning::ln::features::InitFeatures) -> crate::c_types::derived::CVec_u8Z {
1323         crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
1324 }
1325 #[no_mangle]
1326 pub(crate) extern "C" fn InitFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
1327         crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInitFeatures) })
1328 }
1329 #[no_mangle]
1330 /// Read a InitFeatures from a byte array, created by InitFeatures_write
1331 pub extern "C" fn InitFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitFeaturesDecodeErrorZ {
1332         let res: Result<lightning::ln::features::InitFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
1333         let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
1334         local_res
1335 }
1336 #[no_mangle]
1337 /// Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
1338 pub extern "C" fn ChannelFeatures_write(obj: &crate::lightning::ln::features::ChannelFeatures) -> crate::c_types::derived::CVec_u8Z {
1339         crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
1340 }
1341 #[no_mangle]
1342 pub(crate) extern "C" fn ChannelFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
1343         crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelFeatures) })
1344 }
1345 #[no_mangle]
1346 /// Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
1347 pub extern "C" fn ChannelFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelFeaturesDecodeErrorZ {
1348         let res: Result<lightning::ln::features::ChannelFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
1349         let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
1350         local_res
1351 }
1352 #[no_mangle]
1353 /// Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
1354 pub extern "C" fn NodeFeatures_write(obj: &crate::lightning::ln::features::NodeFeatures) -> crate::c_types::derived::CVec_u8Z {
1355         crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
1356 }
1357 #[no_mangle]
1358 pub(crate) extern "C" fn NodeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
1359         crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeFeatures) })
1360 }
1361 #[no_mangle]
1362 /// Read a NodeFeatures from a byte array, created by NodeFeatures_write
1363 pub extern "C" fn NodeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeFeaturesDecodeErrorZ {
1364         let res: Result<lightning::ln::features::NodeFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
1365         let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
1366         local_res
1367 }
1368 #[no_mangle]
1369 /// Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
1370 pub extern "C" fn InvoiceFeatures_write(obj: &crate::lightning::ln::features::InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z {
1371         crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
1372 }
1373 #[no_mangle]
1374 pub(crate) extern "C" fn InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
1375         crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInvoiceFeatures) })
1376 }
1377 #[no_mangle]
1378 /// Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
1379 pub extern "C" fn InvoiceFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InvoiceFeaturesDecodeErrorZ {
1380         let res: Result<lightning::ln::features::InvoiceFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
1381         let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
1382         local_res
1383 }
1384 #[no_mangle]
1385 /// Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
1386 pub extern "C" fn ChannelTypeFeatures_write(obj: &crate::lightning::ln::features::ChannelTypeFeatures) -> crate::c_types::derived::CVec_u8Z {
1387         crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
1388 }
1389 #[no_mangle]
1390 pub(crate) extern "C" fn ChannelTypeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
1391         crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelTypeFeatures) })
1392 }
1393 #[no_mangle]
1394 /// Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
1395 pub extern "C" fn ChannelTypeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelTypeFeaturesDecodeErrorZ {
1396         let res: Result<lightning::ln::features::ChannelTypeFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
1397         let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
1398         local_res
1399 }