Pin compiler_builtins to 0.1.109 when building std
[ldk-c-bindings] / lightning-c-bindings / src / lightning / offers / parse.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 //! Parsing and formatting for bech32 message encoding.
10
11 use alloc::str::FromStr;
12 use alloc::string::String;
13 use core::ffi::c_void;
14 use core::convert::Infallible;
15 use bitcoin::hashes::Hash;
16 use crate::c_types::*;
17 #[cfg(feature="no-std")]
18 use alloc::{vec::Vec, boxed::Box};
19
20 mod sealed {
21
22 use alloc::str::FromStr;
23 use alloc::string::String;
24 use core::ffi::c_void;
25 use core::convert::Infallible;
26 use bitcoin::hashes::Hash;
27 use crate::c_types::*;
28 #[cfg(feature="no-std")]
29 use alloc::{vec::Vec, boxed::Box};
30
31 }
32
33 use lightning::offers::parse::Bolt12ParseError as nativeBolt12ParseErrorImport;
34 pub(crate) type nativeBolt12ParseError = nativeBolt12ParseErrorImport;
35
36 /// Error when parsing a bech32 encoded message using [`str::parse`].
37 #[must_use]
38 #[repr(C)]
39 pub struct Bolt12ParseError {
40         /// A pointer to the opaque Rust object.
41
42         /// Nearly everywhere, inner must be non-null, however in places where
43         /// the Rust equivalent takes an Option, it may be set to null to indicate None.
44         pub inner: *mut nativeBolt12ParseError,
45         /// Indicates that this is the only struct which contains the same pointer.
46
47         /// Rust functions which take ownership of an object provided via an argument require
48         /// this to be true and invalidate the object pointed to by inner.
49         pub is_owned: bool,
50 }
51
52 impl Drop for Bolt12ParseError {
53         fn drop(&mut self) {
54                 if self.is_owned && !<*mut nativeBolt12ParseError>::is_null(self.inner) {
55                         let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
56                 }
57         }
58 }
59 /// Frees any resources used by the Bolt12ParseError, if is_owned is set and inner is non-NULL.
60 #[no_mangle]
61 pub extern "C" fn Bolt12ParseError_free(this_obj: Bolt12ParseError) { }
62 #[allow(unused)]
63 /// Used only if an object of this type is returned as a trait impl by a method
64 pub(crate) extern "C" fn Bolt12ParseError_free_void(this_ptr: *mut c_void) {
65         let _ = unsafe { Box::from_raw(this_ptr as *mut nativeBolt12ParseError) };
66 }
67 #[allow(unused)]
68 impl Bolt12ParseError {
69         pub(crate) fn get_native_ref(&self) -> &'static nativeBolt12ParseError {
70                 unsafe { &*ObjOps::untweak_ptr(self.inner) }
71         }
72         pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeBolt12ParseError {
73                 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
74         }
75         /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
76         pub(crate) fn take_inner(mut self) -> *mut nativeBolt12ParseError {
77                 assert!(self.is_owned);
78                 let ret = ObjOps::untweak_ptr(self.inner);
79                 self.inner = core::ptr::null_mut();
80                 ret
81         }
82 }
83 impl Clone for Bolt12ParseError {
84         fn clone(&self) -> Self {
85                 Self {
86                         inner: if <*mut nativeBolt12ParseError>::is_null(self.inner) { core::ptr::null_mut() } else {
87                                 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
88                         is_owned: true,
89                 }
90         }
91 }
92 #[allow(unused)]
93 /// Used only if an object of this type is returned as a trait impl by a method
94 pub(crate) extern "C" fn Bolt12ParseError_clone_void(this_ptr: *const c_void) -> *mut c_void {
95         Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt12ParseError)).clone() })) as *mut c_void
96 }
97 #[no_mangle]
98 /// Creates a copy of the Bolt12ParseError
99 pub extern "C" fn Bolt12ParseError_clone(orig: &Bolt12ParseError) -> Bolt12ParseError {
100         orig.clone()
101 }
102 /// Get a string which allows debug introspection of a Bolt12ParseError object
103 pub extern "C" fn Bolt12ParseError_debug_str_void(o: *const c_void) -> Str {
104         alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::parse::Bolt12ParseError }).into()}
105 /// Error when interpreting a TLV stream as a specific type.
106 #[derive(Clone)]
107 #[must_use]
108 #[repr(C)]
109 pub enum Bolt12SemanticError {
110         /// The current [`std::time::SystemTime`] is past the offer or invoice's expiration.
111         AlreadyExpired,
112         /// The provided chain hash does not correspond to a supported chain.
113         UnsupportedChain,
114         /// A chain was provided but was not expected.
115         UnexpectedChain,
116         /// An amount was expected but was missing.
117         MissingAmount,
118         /// The amount exceeded the total bitcoin supply.
119         InvalidAmount,
120         /// An amount was provided but was not sufficient in value.
121         InsufficientAmount,
122         /// An amount was provided but was not expected.
123         UnexpectedAmount,
124         /// A currency was provided that is not supported.
125         UnsupportedCurrency,
126         /// A feature was required but is unknown.
127         UnknownRequiredFeatures,
128         /// Features were provided but were not expected.
129         UnexpectedFeatures,
130         /// A required description was not provided.
131         MissingDescription,
132         /// A signing pubkey was not provided.
133         MissingSigningPubkey,
134         /// A signing pubkey was provided but a different one was expected.
135         InvalidSigningPubkey,
136         /// A signing pubkey was provided but was not expected.
137         UnexpectedSigningPubkey,
138         /// A quantity was expected but was missing.
139         MissingQuantity,
140         /// An unsupported quantity was provided.
141         InvalidQuantity,
142         /// A quantity or quantity bounds was provided but was not expected.
143         UnexpectedQuantity,
144         /// Metadata could not be used to verify the offers message.
145         InvalidMetadata,
146         /// Metadata was provided but was not expected.
147         UnexpectedMetadata,
148         /// Payer metadata was expected but was missing.
149         MissingPayerMetadata,
150         /// A payer id was expected but was missing.
151         MissingPayerId,
152         /// The payment id for a refund or request is already in use.
153         DuplicatePaymentId,
154         /// Blinded paths were expected but were missing.
155         MissingPaths,
156         /// Blinded paths were provided but were not expected.
157         UnexpectedPaths,
158         /// The blinded payinfo given does not match the number of blinded path hops.
159         InvalidPayInfo,
160         /// An invoice creation time was expected but was missing.
161         MissingCreationTime,
162         /// An invoice payment hash was expected but was missing.
163         MissingPaymentHash,
164         /// A signature was expected but was missing.
165         MissingSignature,
166 }
167 use lightning::offers::parse::Bolt12SemanticError as Bolt12SemanticErrorImport;
168 pub(crate) type nativeBolt12SemanticError = Bolt12SemanticErrorImport;
169
170 impl Bolt12SemanticError {
171         #[allow(unused)]
172         pub(crate) fn to_native(&self) -> nativeBolt12SemanticError {
173                 match self {
174                         Bolt12SemanticError::AlreadyExpired => nativeBolt12SemanticError::AlreadyExpired,
175                         Bolt12SemanticError::UnsupportedChain => nativeBolt12SemanticError::UnsupportedChain,
176                         Bolt12SemanticError::UnexpectedChain => nativeBolt12SemanticError::UnexpectedChain,
177                         Bolt12SemanticError::MissingAmount => nativeBolt12SemanticError::MissingAmount,
178                         Bolt12SemanticError::InvalidAmount => nativeBolt12SemanticError::InvalidAmount,
179                         Bolt12SemanticError::InsufficientAmount => nativeBolt12SemanticError::InsufficientAmount,
180                         Bolt12SemanticError::UnexpectedAmount => nativeBolt12SemanticError::UnexpectedAmount,
181                         Bolt12SemanticError::UnsupportedCurrency => nativeBolt12SemanticError::UnsupportedCurrency,
182                         Bolt12SemanticError::UnknownRequiredFeatures => nativeBolt12SemanticError::UnknownRequiredFeatures,
183                         Bolt12SemanticError::UnexpectedFeatures => nativeBolt12SemanticError::UnexpectedFeatures,
184                         Bolt12SemanticError::MissingDescription => nativeBolt12SemanticError::MissingDescription,
185                         Bolt12SemanticError::MissingSigningPubkey => nativeBolt12SemanticError::MissingSigningPubkey,
186                         Bolt12SemanticError::InvalidSigningPubkey => nativeBolt12SemanticError::InvalidSigningPubkey,
187                         Bolt12SemanticError::UnexpectedSigningPubkey => nativeBolt12SemanticError::UnexpectedSigningPubkey,
188                         Bolt12SemanticError::MissingQuantity => nativeBolt12SemanticError::MissingQuantity,
189                         Bolt12SemanticError::InvalidQuantity => nativeBolt12SemanticError::InvalidQuantity,
190                         Bolt12SemanticError::UnexpectedQuantity => nativeBolt12SemanticError::UnexpectedQuantity,
191                         Bolt12SemanticError::InvalidMetadata => nativeBolt12SemanticError::InvalidMetadata,
192                         Bolt12SemanticError::UnexpectedMetadata => nativeBolt12SemanticError::UnexpectedMetadata,
193                         Bolt12SemanticError::MissingPayerMetadata => nativeBolt12SemanticError::MissingPayerMetadata,
194                         Bolt12SemanticError::MissingPayerId => nativeBolt12SemanticError::MissingPayerId,
195                         Bolt12SemanticError::DuplicatePaymentId => nativeBolt12SemanticError::DuplicatePaymentId,
196                         Bolt12SemanticError::MissingPaths => nativeBolt12SemanticError::MissingPaths,
197                         Bolt12SemanticError::UnexpectedPaths => nativeBolt12SemanticError::UnexpectedPaths,
198                         Bolt12SemanticError::InvalidPayInfo => nativeBolt12SemanticError::InvalidPayInfo,
199                         Bolt12SemanticError::MissingCreationTime => nativeBolt12SemanticError::MissingCreationTime,
200                         Bolt12SemanticError::MissingPaymentHash => nativeBolt12SemanticError::MissingPaymentHash,
201                         Bolt12SemanticError::MissingSignature => nativeBolt12SemanticError::MissingSignature,
202                 }
203         }
204         #[allow(unused)]
205         pub(crate) fn into_native(self) -> nativeBolt12SemanticError {
206                 match self {
207                         Bolt12SemanticError::AlreadyExpired => nativeBolt12SemanticError::AlreadyExpired,
208                         Bolt12SemanticError::UnsupportedChain => nativeBolt12SemanticError::UnsupportedChain,
209                         Bolt12SemanticError::UnexpectedChain => nativeBolt12SemanticError::UnexpectedChain,
210                         Bolt12SemanticError::MissingAmount => nativeBolt12SemanticError::MissingAmount,
211                         Bolt12SemanticError::InvalidAmount => nativeBolt12SemanticError::InvalidAmount,
212                         Bolt12SemanticError::InsufficientAmount => nativeBolt12SemanticError::InsufficientAmount,
213                         Bolt12SemanticError::UnexpectedAmount => nativeBolt12SemanticError::UnexpectedAmount,
214                         Bolt12SemanticError::UnsupportedCurrency => nativeBolt12SemanticError::UnsupportedCurrency,
215                         Bolt12SemanticError::UnknownRequiredFeatures => nativeBolt12SemanticError::UnknownRequiredFeatures,
216                         Bolt12SemanticError::UnexpectedFeatures => nativeBolt12SemanticError::UnexpectedFeatures,
217                         Bolt12SemanticError::MissingDescription => nativeBolt12SemanticError::MissingDescription,
218                         Bolt12SemanticError::MissingSigningPubkey => nativeBolt12SemanticError::MissingSigningPubkey,
219                         Bolt12SemanticError::InvalidSigningPubkey => nativeBolt12SemanticError::InvalidSigningPubkey,
220                         Bolt12SemanticError::UnexpectedSigningPubkey => nativeBolt12SemanticError::UnexpectedSigningPubkey,
221                         Bolt12SemanticError::MissingQuantity => nativeBolt12SemanticError::MissingQuantity,
222                         Bolt12SemanticError::InvalidQuantity => nativeBolt12SemanticError::InvalidQuantity,
223                         Bolt12SemanticError::UnexpectedQuantity => nativeBolt12SemanticError::UnexpectedQuantity,
224                         Bolt12SemanticError::InvalidMetadata => nativeBolt12SemanticError::InvalidMetadata,
225                         Bolt12SemanticError::UnexpectedMetadata => nativeBolt12SemanticError::UnexpectedMetadata,
226                         Bolt12SemanticError::MissingPayerMetadata => nativeBolt12SemanticError::MissingPayerMetadata,
227                         Bolt12SemanticError::MissingPayerId => nativeBolt12SemanticError::MissingPayerId,
228                         Bolt12SemanticError::DuplicatePaymentId => nativeBolt12SemanticError::DuplicatePaymentId,
229                         Bolt12SemanticError::MissingPaths => nativeBolt12SemanticError::MissingPaths,
230                         Bolt12SemanticError::UnexpectedPaths => nativeBolt12SemanticError::UnexpectedPaths,
231                         Bolt12SemanticError::InvalidPayInfo => nativeBolt12SemanticError::InvalidPayInfo,
232                         Bolt12SemanticError::MissingCreationTime => nativeBolt12SemanticError::MissingCreationTime,
233                         Bolt12SemanticError::MissingPaymentHash => nativeBolt12SemanticError::MissingPaymentHash,
234                         Bolt12SemanticError::MissingSignature => nativeBolt12SemanticError::MissingSignature,
235                 }
236         }
237         #[allow(unused)]
238         pub(crate) fn from_native(native: &Bolt12SemanticErrorImport) -> Self {
239                 let native = unsafe { &*(native as *const _ as *const c_void as *const nativeBolt12SemanticError) };
240                 match native {
241                         nativeBolt12SemanticError::AlreadyExpired => Bolt12SemanticError::AlreadyExpired,
242                         nativeBolt12SemanticError::UnsupportedChain => Bolt12SemanticError::UnsupportedChain,
243                         nativeBolt12SemanticError::UnexpectedChain => Bolt12SemanticError::UnexpectedChain,
244                         nativeBolt12SemanticError::MissingAmount => Bolt12SemanticError::MissingAmount,
245                         nativeBolt12SemanticError::InvalidAmount => Bolt12SemanticError::InvalidAmount,
246                         nativeBolt12SemanticError::InsufficientAmount => Bolt12SemanticError::InsufficientAmount,
247                         nativeBolt12SemanticError::UnexpectedAmount => Bolt12SemanticError::UnexpectedAmount,
248                         nativeBolt12SemanticError::UnsupportedCurrency => Bolt12SemanticError::UnsupportedCurrency,
249                         nativeBolt12SemanticError::UnknownRequiredFeatures => Bolt12SemanticError::UnknownRequiredFeatures,
250                         nativeBolt12SemanticError::UnexpectedFeatures => Bolt12SemanticError::UnexpectedFeatures,
251                         nativeBolt12SemanticError::MissingDescription => Bolt12SemanticError::MissingDescription,
252                         nativeBolt12SemanticError::MissingSigningPubkey => Bolt12SemanticError::MissingSigningPubkey,
253                         nativeBolt12SemanticError::InvalidSigningPubkey => Bolt12SemanticError::InvalidSigningPubkey,
254                         nativeBolt12SemanticError::UnexpectedSigningPubkey => Bolt12SemanticError::UnexpectedSigningPubkey,
255                         nativeBolt12SemanticError::MissingQuantity => Bolt12SemanticError::MissingQuantity,
256                         nativeBolt12SemanticError::InvalidQuantity => Bolt12SemanticError::InvalidQuantity,
257                         nativeBolt12SemanticError::UnexpectedQuantity => Bolt12SemanticError::UnexpectedQuantity,
258                         nativeBolt12SemanticError::InvalidMetadata => Bolt12SemanticError::InvalidMetadata,
259                         nativeBolt12SemanticError::UnexpectedMetadata => Bolt12SemanticError::UnexpectedMetadata,
260                         nativeBolt12SemanticError::MissingPayerMetadata => Bolt12SemanticError::MissingPayerMetadata,
261                         nativeBolt12SemanticError::MissingPayerId => Bolt12SemanticError::MissingPayerId,
262                         nativeBolt12SemanticError::DuplicatePaymentId => Bolt12SemanticError::DuplicatePaymentId,
263                         nativeBolt12SemanticError::MissingPaths => Bolt12SemanticError::MissingPaths,
264                         nativeBolt12SemanticError::UnexpectedPaths => Bolt12SemanticError::UnexpectedPaths,
265                         nativeBolt12SemanticError::InvalidPayInfo => Bolt12SemanticError::InvalidPayInfo,
266                         nativeBolt12SemanticError::MissingCreationTime => Bolt12SemanticError::MissingCreationTime,
267                         nativeBolt12SemanticError::MissingPaymentHash => Bolt12SemanticError::MissingPaymentHash,
268                         nativeBolt12SemanticError::MissingSignature => Bolt12SemanticError::MissingSignature,
269                 }
270         }
271         #[allow(unused)]
272         pub(crate) fn native_into(native: nativeBolt12SemanticError) -> Self {
273                 match native {
274                         nativeBolt12SemanticError::AlreadyExpired => Bolt12SemanticError::AlreadyExpired,
275                         nativeBolt12SemanticError::UnsupportedChain => Bolt12SemanticError::UnsupportedChain,
276                         nativeBolt12SemanticError::UnexpectedChain => Bolt12SemanticError::UnexpectedChain,
277                         nativeBolt12SemanticError::MissingAmount => Bolt12SemanticError::MissingAmount,
278                         nativeBolt12SemanticError::InvalidAmount => Bolt12SemanticError::InvalidAmount,
279                         nativeBolt12SemanticError::InsufficientAmount => Bolt12SemanticError::InsufficientAmount,
280                         nativeBolt12SemanticError::UnexpectedAmount => Bolt12SemanticError::UnexpectedAmount,
281                         nativeBolt12SemanticError::UnsupportedCurrency => Bolt12SemanticError::UnsupportedCurrency,
282                         nativeBolt12SemanticError::UnknownRequiredFeatures => Bolt12SemanticError::UnknownRequiredFeatures,
283                         nativeBolt12SemanticError::UnexpectedFeatures => Bolt12SemanticError::UnexpectedFeatures,
284                         nativeBolt12SemanticError::MissingDescription => Bolt12SemanticError::MissingDescription,
285                         nativeBolt12SemanticError::MissingSigningPubkey => Bolt12SemanticError::MissingSigningPubkey,
286                         nativeBolt12SemanticError::InvalidSigningPubkey => Bolt12SemanticError::InvalidSigningPubkey,
287                         nativeBolt12SemanticError::UnexpectedSigningPubkey => Bolt12SemanticError::UnexpectedSigningPubkey,
288                         nativeBolt12SemanticError::MissingQuantity => Bolt12SemanticError::MissingQuantity,
289                         nativeBolt12SemanticError::InvalidQuantity => Bolt12SemanticError::InvalidQuantity,
290                         nativeBolt12SemanticError::UnexpectedQuantity => Bolt12SemanticError::UnexpectedQuantity,
291                         nativeBolt12SemanticError::InvalidMetadata => Bolt12SemanticError::InvalidMetadata,
292                         nativeBolt12SemanticError::UnexpectedMetadata => Bolt12SemanticError::UnexpectedMetadata,
293                         nativeBolt12SemanticError::MissingPayerMetadata => Bolt12SemanticError::MissingPayerMetadata,
294                         nativeBolt12SemanticError::MissingPayerId => Bolt12SemanticError::MissingPayerId,
295                         nativeBolt12SemanticError::DuplicatePaymentId => Bolt12SemanticError::DuplicatePaymentId,
296                         nativeBolt12SemanticError::MissingPaths => Bolt12SemanticError::MissingPaths,
297                         nativeBolt12SemanticError::UnexpectedPaths => Bolt12SemanticError::UnexpectedPaths,
298                         nativeBolt12SemanticError::InvalidPayInfo => Bolt12SemanticError::InvalidPayInfo,
299                         nativeBolt12SemanticError::MissingCreationTime => Bolt12SemanticError::MissingCreationTime,
300                         nativeBolt12SemanticError::MissingPaymentHash => Bolt12SemanticError::MissingPaymentHash,
301                         nativeBolt12SemanticError::MissingSignature => Bolt12SemanticError::MissingSignature,
302                 }
303         }
304 }
305 /// Creates a copy of the Bolt12SemanticError
306 #[no_mangle]
307 pub extern "C" fn Bolt12SemanticError_clone(orig: &Bolt12SemanticError) -> Bolt12SemanticError {
308         orig.clone()
309 }
310 #[allow(unused)]
311 /// Used only if an object of this type is returned as a trait impl by a method
312 pub(crate) extern "C" fn Bolt12SemanticError_clone_void(this_ptr: *const c_void) -> *mut c_void {
313         Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Bolt12SemanticError)).clone() })) as *mut c_void
314 }
315 #[allow(unused)]
316 /// Used only if an object of this type is returned as a trait impl by a method
317 pub(crate) extern "C" fn Bolt12SemanticError_free_void(this_ptr: *mut c_void) {
318         let _ = unsafe { Box::from_raw(this_ptr as *mut Bolt12SemanticError) };
319 }
320 #[no_mangle]
321 /// Utility method to constructs a new AlreadyExpired-variant Bolt12SemanticError
322 pub extern "C" fn Bolt12SemanticError_already_expired() -> Bolt12SemanticError {
323         Bolt12SemanticError::AlreadyExpired}
324 #[no_mangle]
325 /// Utility method to constructs a new UnsupportedChain-variant Bolt12SemanticError
326 pub extern "C" fn Bolt12SemanticError_unsupported_chain() -> Bolt12SemanticError {
327         Bolt12SemanticError::UnsupportedChain}
328 #[no_mangle]
329 /// Utility method to constructs a new UnexpectedChain-variant Bolt12SemanticError
330 pub extern "C" fn Bolt12SemanticError_unexpected_chain() -> Bolt12SemanticError {
331         Bolt12SemanticError::UnexpectedChain}
332 #[no_mangle]
333 /// Utility method to constructs a new MissingAmount-variant Bolt12SemanticError
334 pub extern "C" fn Bolt12SemanticError_missing_amount() -> Bolt12SemanticError {
335         Bolt12SemanticError::MissingAmount}
336 #[no_mangle]
337 /// Utility method to constructs a new InvalidAmount-variant Bolt12SemanticError
338 pub extern "C" fn Bolt12SemanticError_invalid_amount() -> Bolt12SemanticError {
339         Bolt12SemanticError::InvalidAmount}
340 #[no_mangle]
341 /// Utility method to constructs a new InsufficientAmount-variant Bolt12SemanticError
342 pub extern "C" fn Bolt12SemanticError_insufficient_amount() -> Bolt12SemanticError {
343         Bolt12SemanticError::InsufficientAmount}
344 #[no_mangle]
345 /// Utility method to constructs a new UnexpectedAmount-variant Bolt12SemanticError
346 pub extern "C" fn Bolt12SemanticError_unexpected_amount() -> Bolt12SemanticError {
347         Bolt12SemanticError::UnexpectedAmount}
348 #[no_mangle]
349 /// Utility method to constructs a new UnsupportedCurrency-variant Bolt12SemanticError
350 pub extern "C" fn Bolt12SemanticError_unsupported_currency() -> Bolt12SemanticError {
351         Bolt12SemanticError::UnsupportedCurrency}
352 #[no_mangle]
353 /// Utility method to constructs a new UnknownRequiredFeatures-variant Bolt12SemanticError
354 pub extern "C" fn Bolt12SemanticError_unknown_required_features() -> Bolt12SemanticError {
355         Bolt12SemanticError::UnknownRequiredFeatures}
356 #[no_mangle]
357 /// Utility method to constructs a new UnexpectedFeatures-variant Bolt12SemanticError
358 pub extern "C" fn Bolt12SemanticError_unexpected_features() -> Bolt12SemanticError {
359         Bolt12SemanticError::UnexpectedFeatures}
360 #[no_mangle]
361 /// Utility method to constructs a new MissingDescription-variant Bolt12SemanticError
362 pub extern "C" fn Bolt12SemanticError_missing_description() -> Bolt12SemanticError {
363         Bolt12SemanticError::MissingDescription}
364 #[no_mangle]
365 /// Utility method to constructs a new MissingSigningPubkey-variant Bolt12SemanticError
366 pub extern "C" fn Bolt12SemanticError_missing_signing_pubkey() -> Bolt12SemanticError {
367         Bolt12SemanticError::MissingSigningPubkey}
368 #[no_mangle]
369 /// Utility method to constructs a new InvalidSigningPubkey-variant Bolt12SemanticError
370 pub extern "C" fn Bolt12SemanticError_invalid_signing_pubkey() -> Bolt12SemanticError {
371         Bolt12SemanticError::InvalidSigningPubkey}
372 #[no_mangle]
373 /// Utility method to constructs a new UnexpectedSigningPubkey-variant Bolt12SemanticError
374 pub extern "C" fn Bolt12SemanticError_unexpected_signing_pubkey() -> Bolt12SemanticError {
375         Bolt12SemanticError::UnexpectedSigningPubkey}
376 #[no_mangle]
377 /// Utility method to constructs a new MissingQuantity-variant Bolt12SemanticError
378 pub extern "C" fn Bolt12SemanticError_missing_quantity() -> Bolt12SemanticError {
379         Bolt12SemanticError::MissingQuantity}
380 #[no_mangle]
381 /// Utility method to constructs a new InvalidQuantity-variant Bolt12SemanticError
382 pub extern "C" fn Bolt12SemanticError_invalid_quantity() -> Bolt12SemanticError {
383         Bolt12SemanticError::InvalidQuantity}
384 #[no_mangle]
385 /// Utility method to constructs a new UnexpectedQuantity-variant Bolt12SemanticError
386 pub extern "C" fn Bolt12SemanticError_unexpected_quantity() -> Bolt12SemanticError {
387         Bolt12SemanticError::UnexpectedQuantity}
388 #[no_mangle]
389 /// Utility method to constructs a new InvalidMetadata-variant Bolt12SemanticError
390 pub extern "C" fn Bolt12SemanticError_invalid_metadata() -> Bolt12SemanticError {
391         Bolt12SemanticError::InvalidMetadata}
392 #[no_mangle]
393 /// Utility method to constructs a new UnexpectedMetadata-variant Bolt12SemanticError
394 pub extern "C" fn Bolt12SemanticError_unexpected_metadata() -> Bolt12SemanticError {
395         Bolt12SemanticError::UnexpectedMetadata}
396 #[no_mangle]
397 /// Utility method to constructs a new MissingPayerMetadata-variant Bolt12SemanticError
398 pub extern "C" fn Bolt12SemanticError_missing_payer_metadata() -> Bolt12SemanticError {
399         Bolt12SemanticError::MissingPayerMetadata}
400 #[no_mangle]
401 /// Utility method to constructs a new MissingPayerId-variant Bolt12SemanticError
402 pub extern "C" fn Bolt12SemanticError_missing_payer_id() -> Bolt12SemanticError {
403         Bolt12SemanticError::MissingPayerId}
404 #[no_mangle]
405 /// Utility method to constructs a new DuplicatePaymentId-variant Bolt12SemanticError
406 pub extern "C" fn Bolt12SemanticError_duplicate_payment_id() -> Bolt12SemanticError {
407         Bolt12SemanticError::DuplicatePaymentId}
408 #[no_mangle]
409 /// Utility method to constructs a new MissingPaths-variant Bolt12SemanticError
410 pub extern "C" fn Bolt12SemanticError_missing_paths() -> Bolt12SemanticError {
411         Bolt12SemanticError::MissingPaths}
412 #[no_mangle]
413 /// Utility method to constructs a new UnexpectedPaths-variant Bolt12SemanticError
414 pub extern "C" fn Bolt12SemanticError_unexpected_paths() -> Bolt12SemanticError {
415         Bolt12SemanticError::UnexpectedPaths}
416 #[no_mangle]
417 /// Utility method to constructs a new InvalidPayInfo-variant Bolt12SemanticError
418 pub extern "C" fn Bolt12SemanticError_invalid_pay_info() -> Bolt12SemanticError {
419         Bolt12SemanticError::InvalidPayInfo}
420 #[no_mangle]
421 /// Utility method to constructs a new MissingCreationTime-variant Bolt12SemanticError
422 pub extern "C" fn Bolt12SemanticError_missing_creation_time() -> Bolt12SemanticError {
423         Bolt12SemanticError::MissingCreationTime}
424 #[no_mangle]
425 /// Utility method to constructs a new MissingPaymentHash-variant Bolt12SemanticError
426 pub extern "C" fn Bolt12SemanticError_missing_payment_hash() -> Bolt12SemanticError {
427         Bolt12SemanticError::MissingPaymentHash}
428 #[no_mangle]
429 /// Utility method to constructs a new MissingSignature-variant Bolt12SemanticError
430 pub extern "C" fn Bolt12SemanticError_missing_signature() -> Bolt12SemanticError {
431         Bolt12SemanticError::MissingSignature}
432 /// Get a string which allows debug introspection of a Bolt12SemanticError object
433 pub extern "C" fn Bolt12SemanticError_debug_str_void(o: *const c_void) -> Str {
434         alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::parse::Bolt12SemanticError }).into()}